import{s as et,o as tt}from"../chunks/scheduler.37c15a92.js";import{S as lt,i as st,g as b,s as o,r as u,A as nt,h,f as s,c as i,j as De,u as m,x as w,k as Pe,y as at,a as n,v as M,t as r,b as Le,d as c,w as d,p as Ke}from"../chunks/index.2bf4358c.js";import{C as J}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as Oe}from"../chunks/CourseFloatingBanner.15ba07e6.js";import{F as ot}from"../chunks/FrameworkSwitchCourse.8d4d4ab6.js";import{H as Be}from"../chunks/Heading.8ada512a.js";function it(T){let a,p;return a=new Oe({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter2/section6_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter2/section6_tf.ipynb"}]}}),{c(){u(a.$$.fragment)},l(l){m(a.$$.fragment,l)},m(l,y){M(a,l,y),p=!0},i(l){p||(c(a.$$.fragment,l),p=!0)},o(l){r(a.$$.fragment,l),p=!1},d(l){d(a,l)}}}function pt(T){let a,p;return a=new Oe({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter2/section6_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter2/section6_pt.ipynb"}]}}),{c(){u(a.$$.fragment)},l(l){m(a.$$.fragment,l)},m(l,y){M(a,l,y),p=!0},i(l){p||(c(a.$$.fragment,l),p=!0)},o(l){r(a.$$.fragment,l),p=!1},d(l){d(a,l)}}}function rt(T){let a,p;return a=new J({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMiUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpJTBBc2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEF0b2tlbnMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjB0cnVuY2F0aW9uJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwoKip0b2tlbnMp",highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFAutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = TFAutoModelForSequenceClassification.from_pretrained(checkpoint)
sequences = [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;So have I!&quot;</span>]

tokens = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
output = model(**tokens)`,wrap:!1}}),{c(){u(a.$$.fragment)},l(l){m(a.$$.fragment,l)},m(l,y){M(a,l,y),p=!0},i(l){p||(c(a.$$.fragment,l),p=!0)},o(l){r(a.$$.fragment,l),p=!1},d(l){d(a,l)}}}function ct(T){let a,p;return a=new J({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCklMEFzZXF1ZW5jZXMlMjAlM0QlMjAlNUIlMjJJJ3ZlJTIwYmVlbiUyMHdhaXRpbmclMjBmb3IlMjBhJTIwSHVnZ2luZ0ZhY2UlMjBjb3Vyc2UlMjBteSUyMHdob2xlJTIwbGlmZS4lMjIlMkMlMjAlMjJTbyUyMGhhdmUlMjBJISUyMiU1RCUwQSUwQXRva2VucyUyMCUzRCUyMHRva2VuaXplcihzZXF1ZW5jZXMlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHRydW5jYXRpb24lM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXQlMjAlM0QlMjBtb2RlbCgqKnRva2Vucyk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
sequences = [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;So have I!&quot;</span>]

tokens = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
output = model(**tokens)`,wrap:!1}}),{c(){u(a.$$.fragment)},l(l){m(a.$$.fragment,l)},m(l,y){M(a,l,y),p=!0},i(l){p||(c(a.$$.fragment,l),p=!0)},o(l){r(a.$$.fragment,l),p=!1},d(l){d(a,l)}}}function ut(T){let a,p,l,y,g,le,Z,se,j,f,O,k,Ge="In the last few sections, we’ve been trying our best to do most of the work by hand. We’ve explored how tokenizers work and looked at tokenization, conversion to input IDs, padding, truncation, and attention masks.",ne,V,Xe="However, as we saw in section 2, the 🤗 Transformers API can handle all of this for us with a high-level function that we’ll dive into here. When you call your <code>tokenizer</code> directly on the sentence, you get back inputs that are ready to pass through your model:",ae,W,oe,$,Ne="Here, the <code>model_inputs</code> variable contains everything that’s necessary for a model to operate well. For DistilBERT, that includes the input IDs as well as the attention mask. Other models that accept additional inputs will also have those output by the <code>tokenizer</code> object.",ie,B,ze="As we’ll see in some examples below, this method is very powerful. First, it can tokenize a single sequence:",pe,G,re,X,ve="It also handles multiple sequences at a time, with no change in the API:",ce,N,ue,z,_e="It can pad according to several objectives:",me,v,Me,_,xe="It can also truncate sequences:",de,x,be,S,Se="The <code>tokenizer</code> object can handle the conversion to specific framework tensors, which can then be directly sent to the model. For example, in the following code sample we are prompting the tokenizer to return tensors from the different frameworks — <code>&quot;pt&quot;</code> returns PyTorch tensors, <code>&quot;tf&quot;</code> returns TensorFlow tensors, and <code>&quot;np&quot;</code> returns NumPy arrays:",he,q,ye,R,we,E,qe="If we take a look at the input IDs returned by the tokenizer, we will see they are a tiny bit different from what we had earlier:",Je,C,Te,H,je,Y,Re="One token ID was added at the beginning, and one at the end. Let’s decode the two sequences of IDs above to see what this is about:",fe,Q,Ie,F,Ue,A,Ee="The tokenizer added the special word <code>[CLS]</code> at the beginning and the special word <code>[SEP]</code> at the end. This is because the model was pretrained with those, so to get the same results for inference we need to add them as well. Note that some models don’t add special words, or add different ones; models may also add these special words only at the beginning, or only at the end. In any case, the tokenizer knows which ones are expected and will deal with this for you.",ge,D,Ze,P,Ce="Now that we’ve seen all the individual steps the <code>tokenizer</code> object uses when applied on texts, let’s see one final time how it can handle multiple sequences (padding!), very long sequences (truncation!), and multiple types of tensors with its main API:",ke,I,U,ee,te,Ve;g=new ot({props:{fw:T[0]}}),Z=new Be({props:{title:"Putting it all together",local:"putting-it-all-together",headingTag:"h1"}});const He=[pt,it],L=[];function Ye(e,t){return e[0]==="pt"?0:1}j=Ye(T),f=L[j]=He[j](T),W=new J({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQSUwQXNlcXVlbmNlJTIwJTNEJTIwJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTBBJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(checkpoint)

sequence = <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>

model_inputs = tokenizer(sequence)`,wrap:!1}}),G=new J({props:{code:"c2VxdWVuY2UlMjAlM0QlMjAlMjJJJ3ZlJTIwYmVlbiUyMHdhaXRpbmclMjBmb3IlMjBhJTIwSHVnZ2luZ0ZhY2UlMjBjb3Vyc2UlMjBteSUyMHdob2xlJTIwbGlmZS4lMjIlMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2Up",highlighted:`sequence = <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>

model_inputs = tokenizer(sequence)`,wrap:!1}}),N=new J({props:{code:"c2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzKQ==",highlighted:`sequences = [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;So have I!&quot;</span>]

model_inputs = tokenizer(sequences)`,wrap:!1}}),v=new J({props:{code:"JTIzJTIwV2lsbCUyMHBhZCUyMHRoZSUyMHNlcXVlbmNlcyUyMHVwJTIwdG8lMjB0aGUlMjBtYXhpbXVtJTIwc2VxdWVuY2UlMjBsZW5ndGglMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwcGFkZGluZyUzRCUyMmxvbmdlc3QlMjIpJTBBJTBBJTIzJTIwV2lsbCUyMHBhZCUyMHRoZSUyMHNlcXVlbmNlcyUyMHVwJTIwdG8lMjB0aGUlMjBtb2RlbCUyMG1heCUyMGxlbmd0aCUwQSUyMyUyMCg1MTIlMjBmb3IlMjBCRVJUJTIwb3IlMjBEaXN0aWxCRVJUKSUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihzZXF1ZW5jZXMlMkMlMjBwYWRkaW5nJTNEJTIybWF4X2xlbmd0aCUyMiklMEElMEElMjMlMjBXaWxsJTIwcGFkJTIwdGhlJTIwc2VxdWVuY2VzJTIwdXAlMjB0byUyMHRoZSUyMHNwZWNpZmllZCUyMG1heCUyMGxlbmd0aCUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihzZXF1ZW5jZXMlMkMlMjBwYWRkaW5nJTNEJTIybWF4X2xlbmd0aCUyMiUyQyUyMG1heF9sZW5ndGglM0Q4KQ==",highlighted:`<span class="hljs-comment"># Will pad the sequences up to the maximum sequence length</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-string">&quot;longest&quot;</span>)

<span class="hljs-comment"># Will pad the sequences up to the model max length</span>
<span class="hljs-comment"># (512 for BERT or DistilBERT)</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-string">&quot;max_length&quot;</span>)

<span class="hljs-comment"># Will pad the sequences up to the specified max length</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-string">&quot;max_length&quot;</span>, max_length=<span class="hljs-number">8</span>)`,wrap:!1}}),x=new J({props:{code:"c2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEElMjMlMjBXaWxsJTIwdHJ1bmNhdGUlMjB0aGUlMjBzZXF1ZW5jZXMlMjB0aGF0JTIwYXJlJTIwbG9uZ2VyJTIwdGhhbiUyMHRoZSUyMG1vZGVsJTIwbWF4JTIwbGVuZ3RoJTBBJTIzJTIwKDUxMiUyMGZvciUyMEJFUlQlMjBvciUyMERpc3RpbEJFUlQpJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMHRydW5jYXRpb24lM0RUcnVlKSUwQSUwQSUyMyUyMFdpbGwlMjB0cnVuY2F0ZSUyMHRoZSUyMHNlcXVlbmNlcyUyMHRoYXQlMjBhcmUlMjBsb25nZXIlMjB0aGFuJTIwdGhlJTIwc3BlY2lmaWVkJTIwbWF4JTIwbGVuZ3RoJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMG1heF9sZW5ndGglM0Q4JTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUp",highlighted:`sequences = [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;So have I!&quot;</span>]

<span class="hljs-comment"># Will truncate the sequences that are longer than the model max length</span>
<span class="hljs-comment"># (512 for BERT or DistilBERT)</span>
model_inputs = tokenizer(sequences, truncation=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Will truncate the sequences that are longer than the specified max length</span>
model_inputs = tokenizer(sequences, max_length=<span class="hljs-number">8</span>, truncation=<span class="hljs-literal">True</span>)`,wrap:!1}}),q=new J({props:{code:"c2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEElMjMlMjBSZXR1cm5zJTIwUHlUb3JjaCUyMHRlbnNvcnMlMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMFJldHVybnMlMjBUZW5zb3JGbG93JTIwdGVuc29ycyUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihzZXF1ZW5jZXMlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBJTBBJTIzJTIwUmV0dXJucyUyME51bVB5JTIwYXJyYXlzJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMik=",highlighted:`sequences = [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;So have I!&quot;</span>]

<span class="hljs-comment"># Returns PyTorch tensors</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-comment"># Returns TensorFlow tensors</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)

<span class="hljs-comment"># Returns NumPy arrays</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)`,wrap:!1}}),R=new Be({props:{title:"Special tokens",local:"special-tokens",headingTag:"h2"}}),C=new J({props:{code:"c2VxdWVuY2UlMjAlM0QlMjAlMjJJJ3ZlJTIwYmVlbiUyMHdhaXRpbmclMjBmb3IlMjBhJTIwSHVnZ2luZ0ZhY2UlMjBjb3Vyc2UlMjBteSUyMHdob2xlJTIwbGlmZS4lMjIlMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2UpJTBBcHJpbnQobW9kZWxfaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQSUwQXRva2VucyUyMCUzRCUyMHRva2VuaXplci50b2tlbml6ZShzZXF1ZW5jZSklMEFpZHMlMjAlM0QlMjB0b2tlbml6ZXIuY29udmVydF90b2tlbnNfdG9faWRzKHRva2VucyklMEFwcmludChpZHMp",highlighted:`sequence = <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>

model_inputs = tokenizer(sequence)
<span class="hljs-built_in">print</span>(model_inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])

tokens = tokenizer.tokenize(sequence)
ids = tokenizer.convert_tokens_to_ids(tokens)
<span class="hljs-built_in">print</span>(ids)`,wrap:!1}}),H=new J({props:{code:"JTVCMTAxJTJDJTIwMTA0NSUyQyUyMDEwMDUlMkMlMjAyMzEwJTJDJTIwMjA0MiUyQyUyMDM0MDMlMkMlMjAyMDA1JTJDJTIwMTAzNyUyQyUyMDE3NjYyJTJDJTIwMTIxNzIlMkMlMjAyNjA3JTJDJTIwMjAyNiUyQyUyMDI4NzglMkMlMjAyMTY2JTJDJTIwMTAxMiUyQyUyMDEwMiU1RCUwQSU1QjEwNDUlMkMlMjAxMDA1JTJDJTIwMjMxMCUyQyUyMDIwNDIlMkMlMjAzNDAzJTJDJTIwMjAwNSUyQyUyMDEwMzclMkMlMjAxNzY2MiUyQyUyMDEyMTcyJTJDJTIwMjYwNyUyQyUyMDIwMjYlMkMlMjAyODc4JTJDJTIwMjE2NiUyQyUyMDEwMTIlNUQ=",highlighted:`[<span class="hljs-number">101</span>, <span class="hljs-number">1045</span>, <span class="hljs-number">1005</span>, <span class="hljs-number">2310</span>, <span class="hljs-number">2042</span>, <span class="hljs-number">3403</span>, <span class="hljs-number">2005</span>, <span class="hljs-number">1037</span>, <span class="hljs-number">17662</span>, <span class="hljs-number">12172</span>, <span class="hljs-number">2607</span>, <span class="hljs-number">2026</span>, <span class="hljs-number">2878</span>, <span class="hljs-number">2166</span>, <span class="hljs-number">1012</span>, <span class="hljs-number">102</span>]
[<span class="hljs-number">1045</span>, <span class="hljs-number">1005</span>, <span class="hljs-number">2310</span>, <span class="hljs-number">2042</span>, <span class="hljs-number">3403</span>, <span class="hljs-number">2005</span>, <span class="hljs-number">1037</span>, <span class="hljs-number">17662</span>, <span class="hljs-number">12172</span>, <span class="hljs-number">2607</span>, <span class="hljs-number">2026</span>, <span class="hljs-number">2878</span>, <span class="hljs-number">2166</span>, <span class="hljs-number">1012</span>]`,wrap:!1}}),Q=new J({props:{code:"cHJpbnQodG9rZW5pemVyLmRlY29kZShtb2RlbF9pbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQpKSUwQXByaW50KHRva2VuaXplci5kZWNvZGUoaWRzKSk=",highlighted:`<span class="hljs-built_in">print</span>(tokenizer.decode(model_inputs[<span class="hljs-string">&quot;input_ids&quot;</span>]))
<span class="hljs-built_in">print</span>(tokenizer.decode(ids))`,wrap:!1}}),F=new J({props:{code:"JTIyJTVCQ0xTJTVEJTIwaSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMGh1Z2dpbmdmYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIwJTVCU0VQJTVEJTIyJTBBJTIyaSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMGh1Z2dpbmdmYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIy",highlighted:`<span class="hljs-string">&quot;[CLS] i&#x27;ve been waiting for a huggingface course my whole life. [SEP]&quot;</span>
<span class="hljs-string">&quot;i&#x27;ve been waiting for a huggingface course my whole life.&quot;</span>`,wrap:!1}}),D=new Be({props:{title:"Wrapping up: From tokenizer to model",local:"wrapping-up-from-tokenizer-to-model",headingTag:"h2"}});const Qe=[ct,rt],K=[];function Fe(e,t){return e[0]==="pt"?0:1}return I=Fe(T),U=K[I]=Qe[I](T),{c(){a=b("meta"),p=o(),l=b("p"),y=o(),u(g.$$.fragment),le=o(),u(Z.$$.fragment),se=o(),f.c(),O=o(),k=b("p"),k.textContent=Ge,ne=o(),V=b("p"),V.innerHTML=Xe,ae=o(),u(W.$$.fragment),oe=o(),$=b("p"),$.innerHTML=Ne,ie=o(),B=b("p"),B.textContent=ze,pe=o(),u(G.$$.fragment),re=o(),X=b("p"),X.textContent=ve,ce=o(),u(N.$$.fragment),ue=o(),z=b("p"),z.textContent=_e,me=o(),u(v.$$.fragment),Me=o(),_=b("p"),_.textContent=xe,de=o(),u(x.$$.fragment),be=o(),S=b("p"),S.innerHTML=Se,he=o(),u(q.$$.fragment),ye=o(),u(R.$$.fragment),we=o(),E=b("p"),E.textContent=qe,Je=o(),u(C.$$.fragment),Te=o(),u(H.$$.fragment),je=o(),Y=b("p"),Y.textContent=Re,fe=o(),u(Q.$$.fragment),Ie=o(),u(F.$$.fragment),Ue=o(),A=b("p"),A.innerHTML=Ee,ge=o(),u(D.$$.fragment),Ze=o(),P=b("p"),P.innerHTML=Ce,ke=o(),U.c(),ee=o(),te=b("p"),this.h()},l(e){const t=nt("svelte-u9bgzb",document.head);a=h(t,"META",{name:!0,content:!0}),t.forEach(s),p=i(e),l=h(e,"P",{}),De(l).forEach(s),y=i(e),m(g.$$.fragment,e),le=i(e),m(Z.$$.fragment,e),se=i(e),f.l(e),O=i(e),k=h(e,"P",{"data-svelte-h":!0}),w(k)!=="svelte-8x3t43"&&(k.textContent=Ge),ne=i(e),V=h(e,"P",{"data-svelte-h":!0}),w(V)!=="svelte-1m0etnl"&&(V.innerHTML=Xe),ae=i(e),m(W.$$.fragment,e),oe=i(e),$=h(e,"P",{"data-svelte-h":!0}),w($)!=="svelte-1ppe5qh"&&($.innerHTML=Ne),ie=i(e),B=h(e,"P",{"data-svelte-h":!0}),w(B)!=="svelte-y34ype"&&(B.textContent=ze),pe=i(e),m(G.$$.fragment,e),re=i(e),X=h(e,"P",{"data-svelte-h":!0}),w(X)!=="svelte-164017d"&&(X.textContent=ve),ce=i(e),m(N.$$.fragment,e),ue=i(e),z=h(e,"P",{"data-svelte-h":!0}),w(z)!=="svelte-lvhia5"&&(z.textContent=_e),me=i(e),m(v.$$.fragment,e),Me=i(e),_=h(e,"P",{"data-svelte-h":!0}),w(_)!=="svelte-rx5s8"&&(_.textContent=xe),de=i(e),m(x.$$.fragment,e),be=i(e),S=h(e,"P",{"data-svelte-h":!0}),w(S)!=="svelte-114spo5"&&(S.innerHTML=Se),he=i(e),m(q.$$.fragment,e),ye=i(e),m(R.$$.fragment,e),we=i(e),E=h(e,"P",{"data-svelte-h":!0}),w(E)!=="svelte-1tipyqt"&&(E.textContent=qe),Je=i(e),m(C.$$.fragment,e),Te=i(e),m(H.$$.fragment,e),je=i(e),Y=h(e,"P",{"data-svelte-h":!0}),w(Y)!=="svelte-s6ie2x"&&(Y.textContent=Re),fe=i(e),m(Q.$$.fragment,e),Ie=i(e),m(F.$$.fragment,e),Ue=i(e),A=h(e,"P",{"data-svelte-h":!0}),w(A)!=="svelte-yfjwtr"&&(A.innerHTML=Ee),ge=i(e),m(D.$$.fragment,e),Ze=i(e),P=h(e,"P",{"data-svelte-h":!0}),w(P)!=="svelte-mudtzg"&&(P.innerHTML=Ce),ke=i(e),U.l(e),ee=i(e),te=h(e,"P",{}),De(te).forEach(s),this.h()},h(){Pe(a,"name","hf:doc:metadata"),Pe(a,"content",mt)},m(e,t){at(document.head,a),n(e,p,t),n(e,l,t),n(e,y,t),M(g,e,t),n(e,le,t),M(Z,e,t),n(e,se,t),L[j].m(e,t),n(e,O,t),n(e,k,t),n(e,ne,t),n(e,V,t),n(e,ae,t),M(W,e,t),n(e,oe,t),n(e,$,t),n(e,ie,t),n(e,B,t),n(e,pe,t),M(G,e,t),n(e,re,t),n(e,X,t),n(e,ce,t),M(N,e,t),n(e,ue,t),n(e,z,t),n(e,me,t),M(v,e,t),n(e,Me,t),n(e,_,t),n(e,de,t),M(x,e,t),n(e,be,t),n(e,S,t),n(e,he,t),M(q,e,t),n(e,ye,t),M(R,e,t),n(e,we,t),n(e,E,t),n(e,Je,t),M(C,e,t),n(e,Te,t),M(H,e,t),n(e,je,t),n(e,Y,t),n(e,fe,t),M(Q,e,t),n(e,Ie,t),M(F,e,t),n(e,Ue,t),n(e,A,t),n(e,ge,t),M(D,e,t),n(e,Ze,t),n(e,P,t),n(e,ke,t),K[I].m(e,t),n(e,ee,t),n(e,te,t),Ve=!0},p(e,[t]){const Ae={};t&1&&(Ae.fw=e[0]),g.$set(Ae);let We=j;j=Ye(e),j!==We&&(Ke(),r(L[We],1,1,()=>{L[We]=null}),Le(),f=L[j],f||(f=L[j]=He[j](e),f.c()),c(f,1),f.m(O.parentNode,O));let $e=I;I=Fe(e),I!==$e&&(Ke(),r(K[$e],1,1,()=>{K[$e]=null}),Le(),U=K[I],U||(U=K[I]=Qe[I](e),U.c()),c(U,1),U.m(ee.parentNode,ee))},i(e){Ve||(c(g.$$.fragment,e),c(Z.$$.fragment,e),c(f),c(W.$$.fragment,e),c(G.$$.fragment,e),c(N.$$.fragment,e),c(v.$$.fragment,e),c(x.$$.fragment,e),c(q.$$.fragment,e),c(R.$$.fragment,e),c(C.$$.fragment,e),c(H.$$.fragment,e),c(Q.$$.fragment,e),c(F.$$.fragment,e),c(D.$$.fragment,e),c(U),Ve=!0)},o(e){r(g.$$.fragment,e),r(Z.$$.fragment,e),r(f),r(W.$$.fragment,e),r(G.$$.fragment,e),r(N.$$.fragment,e),r(v.$$.fragment,e),r(x.$$.fragment,e),r(q.$$.fragment,e),r(R.$$.fragment,e),r(C.$$.fragment,e),r(H.$$.fragment,e),r(Q.$$.fragment,e),r(F.$$.fragment,e),r(D.$$.fragment,e),r(U),Ve=!1},d(e){e&&(s(p),s(l),s(y),s(le),s(se),s(O),s(k),s(ne),s(V),s(ae),s(oe),s($),s(ie),s(B),s(pe),s(re),s(X),s(ce),s(ue),s(z),s(me),s(Me),s(_),s(de),s(be),s(S),s(he),s(ye),s(we),s(E),s(Je),s(Te),s(je),s(Y),s(fe),s(Ie),s(Ue),s(A),s(ge),s(Ze),s(P),s(ke),s(ee),s(te)),s(a),d(g,e),d(Z,e),L[j].d(e),d(W,e),d(G,e),d(N,e),d(v,e),d(x,e),d(q,e),d(R,e),d(C,e),d(H,e),d(Q,e),d(F,e),d(D,e),K[I].d(e)}}}const mt='{"title":"Putting it all together","local":"putting-it-all-together","sections":[{"title":"Special tokens","local":"special-tokens","sections":[],"depth":2},{"title":"Wrapping up: From tokenizer to model","local":"wrapping-up-from-tokenizer-to-model","sections":[],"depth":2}],"depth":1}';function Mt(T,a,p){let l="pt";return tt(()=>{const y=new URLSearchParams(window.location.search);p(0,l=y.get("fw")||"pt")}),[l]}class Tt extends lt{constructor(a){super(),st(this,a,Mt,ut,et,{})}}export{Tt as component};
