import{s as nl,o as al}from"../chunks/scheduler.893fe8c9.js";import{S as il,i as pl,e as d,s as i,c as o,h as ul,a as J,d as t,b as p,f as Oe,g as m,j as T,k as el,l as rl,m as n,n as M,o as r,D as ll,t as c,p as b,E as tl}from"../chunks/index.6ee278c6.js";import{C as cl,H as Ne,E as ol}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.ea3ad860.js";import{C as j}from"../chunks/CodeBlock.8bdd5f33.js";import{C as sl}from"../chunks/CourseFloatingBanner.c25cfa5e.js";import{F as ml}from"../chunks/FrameworkSwitchCourse.77a18d50.js";function Ml(w){let a,u;return a=new sl({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(){o(a.$$.fragment)},l(s){m(a.$$.fragment,s)},m(s,y){M(a,s,y),u=!0},i(s){u||(c(a.$$.fragment,s),u=!0)},o(s){r(a.$$.fragment,s),u=!1},d(s){b(a,s)}}}function bl(w){let a,u;return a=new sl({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(){o(a.$$.fragment)},l(s){m(a.$$.fragment,s)},m(s,y){M(a,s,y),u=!0},i(s){u||(c(a.$$.fragment,s),u=!0)},o(s){r(a.$$.fragment,s),u=!1},d(s){b(a,s)}}}function dl(w){let a,u;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(){o(a.$$.fragment)},l(s){m(a.$$.fragment,s)},m(s,y){M(a,s,y),u=!0},i(s){u||(c(a.$$.fragment,s),u=!0)},o(s){r(a.$$.fragment,s),u=!1},d(s){b(a,s)}}}function Jl(w){let a,u;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(){o(a.$$.fragment)},l(s){m(a.$$.fragment,s)},m(s,y){M(a,s,y),u=!0},i(s){u||(c(a.$$.fragment,s),u=!0)},o(s){r(a.$$.fragment,s),u=!1},d(s){b(a,s)}}}function yl(w){let a,u,s,y,g,ne,Z,ae,V,ie,f,h,le,k,Ge="În ultimele secțiuni, ne-am străduit să facem cea mai mare parte a muncii manual. Am explorat modul în care funcționează tokenizatoarele și am analizat tokenizarea, conversia în ID-uri de intrare, padding, trunchiere și măști de atenție.",pe,$,Ee="Cu toate acestea, după cum am văzut în secțiunea 2, API-ul 🤗 Transformers poate gestiona toate acestea pentru noi cu o funcție de nivel înalt în care ne vom adânci aici. Atunci când apelați <code>tokenizer</code> direct pe propoziție, primiți înapoi intrări care sunt gata să treacă prin modelul dvs:",ue,W,re,z,xe="Aici, variabila <code>model_inputs</code> conține tot ceea ce este necesar pentru ca un model să funcționeze bine. Pentru DistilBERT, aceasta include ID-urile de intrare, precum și masca de atenție. Alte modele care acceptă intrări suplimentare le vor avea, de asemenea, la ieșire prin obiectul <code>tokenizer</code>.",ce,v,_e="După cum vom vedea în câteva exemple de mai jos, această metodă este foarte puternică. În primul rând, poate tokeniza o singură secvență:",oe,B,me,S,Qe="De asemenea, gestionează mai multe secvențe simultan, fără nicio modificare a API-ului:",Me,N,be,G,Xe="Poate aplica padding în funcție de mai multe obiective:",de,E,Je,x,Ye="De asemenea, poate trunchia secvențele:",ye,_,Te,Q,Re="Obiectul <code>tokenizer</code> poate gestiona conversia în tensori specifici framework-ului, care pot fi apoi trimiși direct la model. De exemplu, în următorul exemplu de cod, solicităm tokenizatorului să returneze tensori din diferite framework-uri - <code>„pt”</code> returnează tensori PyTorch, <code>„tf”</code> returnează tensori TensorFlow, iar <code>„np”</code> returnează matrici NumPy:",je,X,we,Y,fe,R,Ce="Dacă aruncăm o privire la ID-urile de intrare returnate de tokenizer, vom vedea că sunt puțin diferite de cele pe care le-am avut mai devreme:",he,C,Ue,H,Ie,q,He="Un token ID a fost adăugat la început, iar unul la sfârșit. Să decodificăm cele două secvențe de ID-uri de mai sus pentru a vedea despre ce este vorba:",ge,F,Ze,D,Ve,A,qe="Tokenizatorul a adăugat cuvântul special <code>[CLS]</code> la început și cuvântul special <code>[SEP]</code> la sfârșit. Acest lucru se datorează faptului că modelul a fost preantrenat cu aceste cuvinte, deci pentru a obține aceleași rezultate pentru inferență trebuie să le adăugăm și pe acestea. Rețineți că unele modele nu adaugă cuvinte speciale sau adaugă cuvinte diferite; de asemenea, modelele pot adăuga aceste cuvinte speciale doar la început sau doar la sfârșit. În orice caz, tokenizatorul știe care sunt cele așteptate și se va ocupa de acest lucru pentru dumneavoastră.",ke,P,$e,L,Fe="Acum că am văzut toți pașii individuali pe care îi utilizează obiectul <code>tokenizer</code> atunci când este aplicat pe texte, să vedem o ultimă dată cum poate gestiona secvențe multiple (padding!), secvențe foarte lungi (trunchiere!) și mai multe tipuri de tensori cu API-ul său principal:",We,U,I,te,K,ze,se,ve;g=new ml({props:{fw:w[0]}}),Z=new cl({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),V=new Ne({props:{title:"Să punem totul cap la cap",local:"să-punem-totul-cap-la-cap",headingTag:"h1"}});const De=[bl,Ml],O=[];function Ae(e,l){return e[0]==="pt"?0:1}f=Ae(w),h=O[f]=De[f](w),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}}),B=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}}),E=new j({props:{code:"JTIzJTIwVmElMjB1bXBsZSUyMHNlY3ZlbiVDOCU5QmVsZSUyMHAlQzMlQTJuJUM0JTgzJTIwbGElMjBsdW5naW1lYSUyMG1heGltJUM0JTgzJTIwYSUyMHNlY3ZlbiVDOCU5QmVpJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMHBhZGRpbmclM0QlMjJsb25nZXN0JTIyKSUwQSUwQSUyMyUyMFZhJTIwdW1wbGUlMjBzZWN2ZW4lQzglOUJlbGUlMjBwJUMzJUEybiVDNCU4MyUyMGxhJTIwbHVuZ2ltZWElMjBtYXhpbSVDNCU4MyUyMGElMjBtb2RlbHVsdWklMEElMjMlMjAoNTEyJTIwcGVudHJ1JTIwQkVSVCUyMHNhdSUyMERpc3RpbEJFUlQpJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMHBhZGRpbmclM0QlMjJtYXhfbGVuZ3RoJTIyKSUwQSUwQSUyMyUyMFZhJTIwdW1wbGUlMjBzZWN2ZW4lQzglOUJlbGUlMjBwJUMzJUEybiVDNCU4MyUyMGxhJTIwbHVuZ2ltZWElMjBtYXhpbSVDNCU4MyUyMHNwZWNpZmljYXQlQzQlODMlMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwcGFkZGluZyUzRCUyMm1heF9sZW5ndGglMjIlMkMlMjBtYXhfbGVuZ3RoJTNEOCk=",highlighted:`<span class="hljs-comment"># Va umple secvențele până la lungimea maximă a secvenței</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-string">&quot;longest&quot;</span>)

<span class="hljs-comment"># Va umple secvențele până la lungimea maximă a modelului</span>
<span class="hljs-comment"># (512 pentru BERT sau DistilBERT)</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-string">&quot;max_length&quot;</span>)

<span class="hljs-comment"># Va umple secvențele până la lungimea maximă specificată</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}}),_=new j({props:{code:"c2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEElMjMlMjBWYSUyMHRydW5jaGlhJTIwc2VjdmVuJUM4JTlCZWxlJTIwY2FyZSUyMHN1bnQlMjBtYWklMjBsdW5naSUyMGRlYyVDMyVBMnQlMjBsdW5naW1lYSUyMG1heGltJUM0JTgzJTIwYSUyMG1vZGVsdWx1aSUwQSUyMyUyMCg1MTIlMjBwZW50cnUlMjBCRVJUJTIwc2F1JTIwRGlzdGlsQkVSVCklMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUpJTBBJTBBJTIzJTIwVmElMjB0cnVuY2hpYSUyMHNlY3ZlbiVDOCU5QmVsZSUyMGNhcmUlMjBzdW50JTIwbWFpJTIwbHVuZ2klMjBkZWMlQzMlQTJ0JTIwbHVuZ2ltZWElMjBtYXhpbSVDNCU4MyUyMHNwZWNpZmljYXQlQzQlODMlMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwbWF4X2xlbmd0aCUzRDglMkMlMjB0cnVuY2F0aW9uJTNEVHJ1ZSk=",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"># Va trunchia secvențele care sunt mai lungi decât lungimea maximă a modelului</span>
<span class="hljs-comment"># (512 pentru BERT sau DistilBERT)</span>
model_inputs = tokenizer(sequences, truncation=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Va trunchia secvențele care sunt mai lungi decât lungimea maximă specificată</span>
model_inputs = tokenizer(sequences, max_length=<span class="hljs-number">8</span>, truncation=<span class="hljs-literal">True</span>)`,wrap:!1}}),X=new j({props:{code:"c2VxdWVuY2VzJTIwJTNEJTIwJTVCJTIySSd2ZSUyMGJlZW4lMjB3YWl0aW5nJTIwZm9yJTIwYSUyMEh1Z2dpbmdGYWNlJTIwY291cnNlJTIwbXklMjB3aG9sZSUyMGxpZmUuJTIyJTJDJTIwJTIyU28lMjBoYXZlJTIwSSElMjIlNUQlMEElMEElMjMlMjBSZXR1cm5lYXolQzQlODMlMjB0ZW5zb3JpJTIwUHlUb3JjaCUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihzZXF1ZW5jZXMlMkMlMjBwYWRkaW5nJTNEVHJ1ZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwUmV0dXJuZWF6JUM0JTgzJTIwdGVuc29yaSUyMFRlbnNvckZsb3clMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoc2VxdWVuY2VzJTJDJTIwcGFkZGluZyUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQSUwQSUyMyUyMFJldHVybmVheiVDNCU4MyUyMGFycmF5LXVyaSUyME51bVB5JTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHNlcXVlbmNlcyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJucCUyMik=",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"># Returnează tensori PyTorch</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"># Returnează tensori TensorFlow</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"># Returnează array-uri NumPy</span>
model_inputs = tokenizer(sequences, padding=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)`,wrap:!1}}),Y=new Ne({props:{title:"Token-uri speciale",local:"token-uri-speciale",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}}),F=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}}),D=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}}),P=new Ne({props:{title:"Încheiere: De la tokenizer la model",local:"încheiere-de-la-tokenizator-la-model",headingTag:"h2"}});const Pe=[Jl,dl],ee=[];function Le(e,l){return e[0]==="pt"?0:1}return U=Le(w),I=ee[U]=Pe[U](w),K=new ol({props:{source:"https://github.com/huggingface/course/blob/main/chapters/ro/chapter2/6.mdx"}}),{c(){a=d("meta"),u=i(),s=d("p"),y=i(),o(g.$$.fragment),ne=i(),o(Z.$$.fragment),ae=i(),o(V.$$.fragment),ie=i(),h.c(),le=i(),k=d("p"),k.textContent=Ge,pe=i(),$=d("p"),$.innerHTML=Ee,ue=i(),o(W.$$.fragment),re=i(),z=d("p"),z.innerHTML=xe,ce=i(),v=d("p"),v.textContent=_e,oe=i(),o(B.$$.fragment),me=i(),S=d("p"),S.textContent=Qe,Me=i(),o(N.$$.fragment),be=i(),G=d("p"),G.textContent=Xe,de=i(),o(E.$$.fragment),Je=i(),x=d("p"),x.textContent=Ye,ye=i(),o(_.$$.fragment),Te=i(),Q=d("p"),Q.innerHTML=Re,je=i(),o(X.$$.fragment),we=i(),o(Y.$$.fragment),fe=i(),R=d("p"),R.textContent=Ce,he=i(),o(C.$$.fragment),Ue=i(),o(H.$$.fragment),Ie=i(),q=d("p"),q.textContent=He,ge=i(),o(F.$$.fragment),Ze=i(),o(D.$$.fragment),Ve=i(),A=d("p"),A.innerHTML=qe,ke=i(),o(P.$$.fragment),$e=i(),L=d("p"),L.innerHTML=Fe,We=i(),I.c(),te=i(),o(K.$$.fragment),ze=i(),se=d("p"),this.h()},l(e){const l=ul("svelte-u9bgzb",document.head);a=J(l,"META",{name:!0,content:!0}),l.forEach(t),u=p(e),s=J(e,"P",{}),Oe(s).forEach(t),y=p(e),m(g.$$.fragment,e),ne=p(e),m(Z.$$.fragment,e),ae=p(e),m(V.$$.fragment,e),ie=p(e),h.l(e),le=p(e),k=J(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-debj4s"&&(k.textContent=Ge),pe=p(e),$=J(e,"P",{"data-svelte-h":!0}),T($)!=="svelte-1hco84t"&&($.innerHTML=Ee),ue=p(e),m(W.$$.fragment,e),re=p(e),z=J(e,"P",{"data-svelte-h":!0}),T(z)!=="svelte-5ylyo3"&&(z.innerHTML=xe),ce=p(e),v=J(e,"P",{"data-svelte-h":!0}),T(v)!=="svelte-xxf8ed"&&(v.textContent=_e),oe=p(e),m(B.$$.fragment,e),me=p(e),S=J(e,"P",{"data-svelte-h":!0}),T(S)!=="svelte-19jvf1t"&&(S.textContent=Qe),Me=p(e),m(N.$$.fragment,e),be=p(e),G=J(e,"P",{"data-svelte-h":!0}),T(G)!=="svelte-12j5yca"&&(G.textContent=Xe),de=p(e),m(E.$$.fragment,e),Je=p(e),x=J(e,"P",{"data-svelte-h":!0}),T(x)!=="svelte-k2u6eu"&&(x.textContent=Ye),ye=p(e),m(_.$$.fragment,e),Te=p(e),Q=J(e,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-1hpqg7u"&&(Q.innerHTML=Re),je=p(e),m(X.$$.fragment,e),we=p(e),m(Y.$$.fragment,e),fe=p(e),R=J(e,"P",{"data-svelte-h":!0}),T(R)!=="svelte-ydjxmx"&&(R.textContent=Ce),he=p(e),m(C.$$.fragment,e),Ue=p(e),m(H.$$.fragment,e),Ie=p(e),q=J(e,"P",{"data-svelte-h":!0}),T(q)!=="svelte-i2lejn"&&(q.textContent=He),ge=p(e),m(F.$$.fragment,e),Ze=p(e),m(D.$$.fragment,e),Ve=p(e),A=J(e,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1wvuh16"&&(A.innerHTML=qe),ke=p(e),m(P.$$.fragment,e),$e=p(e),L=J(e,"P",{"data-svelte-h":!0}),T(L)!=="svelte-pyekyx"&&(L.innerHTML=Fe),We=p(e),I.l(e),te=p(e),m(K.$$.fragment,e),ze=p(e),se=J(e,"P",{}),Oe(se).forEach(t),this.h()},h(){el(a,"name","hf:doc:metadata"),el(a,"content",Tl)},m(e,l){rl(document.head,a),n(e,u,l),n(e,s,l),n(e,y,l),M(g,e,l),n(e,ne,l),M(Z,e,l),n(e,ae,l),M(V,e,l),n(e,ie,l),O[f].m(e,l),n(e,le,l),n(e,k,l),n(e,pe,l),n(e,$,l),n(e,ue,l),M(W,e,l),n(e,re,l),n(e,z,l),n(e,ce,l),n(e,v,l),n(e,oe,l),M(B,e,l),n(e,me,l),n(e,S,l),n(e,Me,l),M(N,e,l),n(e,be,l),n(e,G,l),n(e,de,l),M(E,e,l),n(e,Je,l),n(e,x,l),n(e,ye,l),M(_,e,l),n(e,Te,l),n(e,Q,l),n(e,je,l),M(X,e,l),n(e,we,l),M(Y,e,l),n(e,fe,l),n(e,R,l),n(e,he,l),M(C,e,l),n(e,Ue,l),M(H,e,l),n(e,Ie,l),n(e,q,l),n(e,ge,l),M(F,e,l),n(e,Ze,l),M(D,e,l),n(e,Ve,l),n(e,A,l),n(e,ke,l),M(P,e,l),n(e,$e,l),n(e,L,l),n(e,We,l),ee[U].m(e,l),n(e,te,l),M(K,e,l),n(e,ze,l),n(e,se,l),ve=!0},p(e,[l]){const Ke={};l&1&&(Ke.fw=e[0]),g.$set(Ke);let Be=f;f=Ae(e),f!==Be&&(tl(),r(O[Be],1,1,()=>{O[Be]=null}),ll(),h=O[f],h||(h=O[f]=De[f](e),h.c()),c(h,1),h.m(le.parentNode,le));let Se=U;U=Le(e),U!==Se&&(tl(),r(ee[Se],1,1,()=>{ee[Se]=null}),ll(),I=ee[U],I||(I=ee[U]=Pe[U](e),I.c()),c(I,1),I.m(te.parentNode,te))},i(e){ve||(c(g.$$.fragment,e),c(Z.$$.fragment,e),c(V.$$.fragment,e),c(h),c(W.$$.fragment,e),c(B.$$.fragment,e),c(N.$$.fragment,e),c(E.$$.fragment,e),c(_.$$.fragment,e),c(X.$$.fragment,e),c(Y.$$.fragment,e),c(C.$$.fragment,e),c(H.$$.fragment,e),c(F.$$.fragment,e),c(D.$$.fragment,e),c(P.$$.fragment,e),c(I),c(K.$$.fragment,e),ve=!0)},o(e){r(g.$$.fragment,e),r(Z.$$.fragment,e),r(V.$$.fragment,e),r(h),r(W.$$.fragment,e),r(B.$$.fragment,e),r(N.$$.fragment,e),r(E.$$.fragment,e),r(_.$$.fragment,e),r(X.$$.fragment,e),r(Y.$$.fragment,e),r(C.$$.fragment,e),r(H.$$.fragment,e),r(F.$$.fragment,e),r(D.$$.fragment,e),r(P.$$.fragment,e),r(I),r(K.$$.fragment,e),ve=!1},d(e){e&&(t(u),t(s),t(y),t(ne),t(ae),t(ie),t(le),t(k),t(pe),t($),t(ue),t(re),t(z),t(ce),t(v),t(oe),t(me),t(S),t(Me),t(be),t(G),t(de),t(Je),t(x),t(ye),t(Te),t(Q),t(je),t(we),t(fe),t(R),t(he),t(Ue),t(Ie),t(q),t(ge),t(Ze),t(Ve),t(A),t(ke),t($e),t(L),t(We),t(te),t(ze),t(se)),t(a),b(g,e),b(Z,e),b(V,e),O[f].d(e),b(W,e),b(B,e),b(N,e),b(E,e),b(_,e),b(X,e),b(Y,e),b(C,e),b(H,e),b(F,e),b(D,e),b(P,e),ee[U].d(e),b(K,e)}}}const Tl='{"title":"Să punem totul cap la cap","local":"să-punem-totul-cap-la-cap","sections":[{"title":"Token-uri speciale","local":"token-uri-speciale","sections":[],"depth":2},{"title":"Încheiere: De la tokenizer la model","local":"încheiere-de-la-tokenizator-la-model","sections":[],"depth":2}],"depth":1}';function jl(w,a,u){let s="pt";return al(()=>{const y=new URLSearchParams(window.location.search);u(0,s=y.get("fw")||"pt")}),[s]}class Zl extends il{constructor(a){super(),pl(this,a,jl,yl,nl,{})}}export{Zl as component};
