import{s as Nn,o as En,n as An}from"../chunks/scheduler.893fe8c9.js";import{S as Wn,i as vn,e as y,s as a,c as u,h as Vn,a as T,d as e,b as t,f as Qn,g as J,j as d,k as ve,l as Gn,m as n,n as o,o as c,D as Qe,t as M,p as j,E as Ze}from"../chunks/index.6ee278c6.js";import{T as Zn}from"../chunks/Tip.eab0255c.js";import{C as Rn,H as cl,E as Hn}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.ea3ad860.js";import{Y as Ae}from"../chunks/Youtube.59d04f41.js";import{C as w}from"../chunks/CodeBlock.8bdd5f33.js";import{C as Sn}from"../chunks/CourseFloatingBanner.c25cfa5e.js";import{F as Xn}from"../chunks/FrameworkSwitchCourse.77a18d50.js";function Dn(x){let i,m;return i=new Sn({props:{chapter:6,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/chapter6/section3_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter6/section3_tf.ipynb"}]}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function _n(x){let i,m;return i=new Sn({props:{chapter:6,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/chapter6/section3_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter6/section3_pt.ipynb"}]}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function Yn(x){let i,m="⚠️ Atunci când tokenizați o singură propoziție, nu veți vedea întotdeauna o diferență de viteză între versiunea lentă și rapidă ale aceluiași tokenizer. De fapt, versiunea rapidă poate fi chiar mai lentă! Abia atunci când tokenizați multe texte în paralel, în același timp, veți putea observa clar diferența.";return{c(){i=y("p"),i.textContent=m},l(p){i=T(p,"P",{"data-svelte-h":!0}),d(i)!=="svelte-1v2hpym"&&(i.textContent=m)},m(p,U){n(p,i,U)},p:An,d(p){p&&e(i)}}}function Fn(x){let i,m="✏️ <strong>Încercați!</strong> Creați propriul exemplu de text și încercați să înțelegeți care tokenuri sunt asociate cu ID-ul cuvântului și, de asemenea, cum să extrageți spanurile pentru singur cuvânt. Pentru puncte bonus, încercați să utilizați două propoziții ca inputuri și să vedeți dacă ID-urile propozițiilor au sens pentru voi.";return{c(){i=y("p"),i.innerHTML=m},l(p){i=T(p,"P",{"data-svelte-h":!0}),d(i)!=="svelte-156m91r"&&(i.innerHTML=m)},m(p,U){n(p,i,U)},p:An,d(p){p&&e(i)}}}function Ln(x){let i,m;return i=new Ae({props:{id:"PrX4CjrVnNc"}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function On(x){let i,m;return i=new Ae({props:{id:"0E7ltQB7fM8"}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function qn(x){let i,m='În primul rând trebuie să tokenizăm inputurile și să le trecem prin model. Acest lucru este făcut excat ca în <a href="/course/chapter2">Capitolul 2</a>; noi am inițializat tokenizerul și modelul folosind clasa <code>TFAutoXxx</code> și apoi am folosit-o pe exemplul nostru:',p,U,k,g,z="Deoarece aici folosim <code>TFAutoModelForTokenClassification</code>, noi primim un set de logits pentru fiecare token în input sequence:",C,I,$,b,f;return U=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbF9jaGVja3BvaW50JTIwJTNEJTIwJTIyZGJtZHolMkZiZXJ0LWxhcmdlLWNhc2VkLWZpbmV0dW5lZC1jb25sbDAzLWVuZ2xpc2glMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9jaGVja3BvaW50KSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChtb2RlbF9jaGVja3BvaW50KSUwQSUwQWV4YW1wbGUlMjAlM0QlMjAlMjJNeSUyMG5hbWUlMjBpcyUyMFN5bHZhaW4lMjBhbmQlMjBJJTIwd29yayUyMGF0JTIwSHVnZ2luZyUyMEZhY2UlMjBpbiUyMEJyb29rbHluLiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihleGFtcGxlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFAutoModelForTokenClassification

model_checkpoint = <span class="hljs-string">&quot;dbmdz/bert-large-cased-finetuned-conll03-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = TFAutoModelForTokenClassification.from_pretrained(model_checkpoint)

example = <span class="hljs-string">&quot;My name is Sylvain and I work at Hugging Face in Brooklyn.&quot;</span>
inputs = tokenizer(example, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
outputs = model(**inputs)`,wrap:!1}}),I=new w({props:{code:"cHJpbnQoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVELnNoYXBlKSUwQXByaW50KG91dHB1dHMubG9naXRzLnNoYXBlKQ==",highlighted:`<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>].shape)
<span class="hljs-built_in">print</span>(outputs.logits.shape)`,wrap:!1}}),b=new w({props:{code:"KDElMkMlMjAxOSklMEEoMSUyQyUyMDE5JTJDJTIwOSk=",highlighted:`(<span class="hljs-number">1</span>, <span class="hljs-number">19</span>)
(<span class="hljs-number">1</span>, <span class="hljs-number">19</span>, <span class="hljs-number">9</span>)`,wrap:!1}}),{c(){i=y("p"),i.innerHTML=m,p=a(),u(U.$$.fragment),k=a(),g=y("p"),g.innerHTML=z,C=a(),u(I.$$.fragment),$=a(),u(b.$$.fragment)},l(r){i=T(r,"P",{"data-svelte-h":!0}),d(i)!=="svelte-xeer8m"&&(i.innerHTML=m),p=t(r),J(U.$$.fragment,r),k=t(r),g=T(r,"P",{"data-svelte-h":!0}),d(g)!=="svelte-xwcf2h"&&(g.innerHTML=z),C=t(r),J(I.$$.fragment,r),$=t(r),J(b.$$.fragment,r)},m(r,h){n(r,i,h),n(r,p,h),o(U,r,h),n(r,k,h),n(r,g,h),n(r,C,h),o(I,r,h),n(r,$,h),o(b,r,h),f=!0},i(r){f||(M(U.$$.fragment,r),M(I.$$.fragment,r),M(b.$$.fragment,r),f=!0)},o(r){c(U.$$.fragment,r),c(I.$$.fragment,r),c(b.$$.fragment,r),f=!1},d(r){r&&(e(i),e(p),e(k),e(g),e(C),e($)),j(U,r),j(I,r),j(b,r)}}}function Pn(x){let i,m='În primul rând trebuie să tokenizăm inputurile și sp le trecem prin model. Acest lucru este făcut excat ca în <a href="/course/chapter2">Capitolul 2</a>; noi am inițializat tokenizerul și modelul folosind clasa <code>AutoXxx</code> și apoi am folosit-o pe exemplul nostru:',p,U,k,g,z="Deoarece aici folosim <code>AutoModelForTokenClassification</code> , noi primim un set de logits pentru fiecare token în input sequence:",C,I,$,b,f;return U=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBJTBBbW9kZWxfY2hlY2twb2ludCUyMCUzRCUyMCUyMmRibWR6JTJGYmVydC1sYXJnZS1jYXNlZC1maW5ldHVuZWQtY29ubGwwMy1lbmdsaXNoJTIyJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfY2hlY2twb2ludCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2NoZWNrcG9pbnQpJTBBJTBBZXhhbXBsZSUyMCUzRCUyMCUyMk15JTIwbmFtZSUyMGlzJTIwU3lsdmFpbiUyMGFuZCUyMEklMjB3b3JrJTIwYXQlMjBIdWdnaW5nJTIwRmFjZSUyMGluJTIwQnJvb2tseW4uJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGV4YW1wbGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForTokenClassification

model_checkpoint = <span class="hljs-string">&quot;dbmdz/bert-large-cased-finetuned-conll03-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = AutoModelForTokenClassification.from_pretrained(model_checkpoint)

example = <span class="hljs-string">&quot;My name is Sylvain and I work at Hugging Face in Brooklyn.&quot;</span>
inputs = tokenizer(example, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
outputs = model(**inputs)`,wrap:!1}}),I=new w({props:{code:"cHJpbnQoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVELnNoYXBlKSUwQXByaW50KG91dHB1dHMubG9naXRzLnNoYXBlKQ==",highlighted:`<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>].shape)
<span class="hljs-built_in">print</span>(outputs.logits.shape)`,wrap:!1}}),b=new w({props:{code:"dG9yY2guU2l6ZSglNUIxJTJDJTIwMTklNUQpJTBBdG9yY2guU2l6ZSglNUIxJTJDJTIwMTklMkMlMjA5JTVEKQ==",highlighted:`torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">19</span>])
torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">19</span>, <span class="hljs-number">9</span>])`,wrap:!1}}),{c(){i=y("p"),i.innerHTML=m,p=a(),u(U.$$.fragment),k=a(),g=y("p"),g.innerHTML=z,C=a(),u(I.$$.fragment),$=a(),u(b.$$.fragment)},l(r){i=T(r,"P",{"data-svelte-h":!0}),d(i)!=="svelte-51gmlr"&&(i.innerHTML=m),p=t(r),J(U.$$.fragment,r),k=t(r),g=T(r,"P",{"data-svelte-h":!0}),d(g)!=="svelte-ro5kdh"&&(g.innerHTML=z),C=t(r),J(I.$$.fragment,r),$=t(r),J(b.$$.fragment,r)},m(r,h){n(r,i,h),n(r,p,h),o(U,r,h),n(r,k,h),n(r,g,h),n(r,C,h),o(I,r,h),n(r,$,h),o(b,r,h),f=!0},i(r){f||(M(U.$$.fragment,r),M(I.$$.fragment,r),M(b.$$.fragment,r),f=!0)},o(r){c(U.$$.fragment,r),c(I.$$.fragment,r),c(b.$$.fragment,r),f=!1},d(r){r&&(e(i),e(p),e(k),e(g),e(C),e($)),j(U,r),j(I,r),j(b,r)}}}function Kn(x){let i,m;return i=new w({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFwcm9iYWJpbGl0aWVzJTIwJTNEJTIwdGYubWF0aC5zb2Z0bWF4KG91dHB1dHMubG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQlMEFwcm9iYWJpbGl0aWVzJTIwJTNEJTIwcHJvYmFiaWxpdGllcy5udW1weSgpLnRvbGlzdCgpJTBBcHJlZGljdGlvbnMlMjAlM0QlMjB0Zi5tYXRoLmFyZ21heChvdXRwdXRzLmxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEJTBBcHJlZGljdGlvbnMlMjAlM0QlMjBwcmVkaWN0aW9ucy5udW1weSgpLnRvbGlzdCgpJTBBcHJpbnQocHJlZGljdGlvbnMp",highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

probabilities = tf.math.softmax(outputs.logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]
probabilities = probabilities.numpy().tolist()
predictions = tf.math.argmax(outputs.logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]
predictions = predictions.numpy().tolist()
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function sa(x){let i,m;return i=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFwcm9iYWJpbGl0aWVzJTIwJTNEJTIwdG9yY2gubm4uZnVuY3Rpb25hbC5zb2Z0bWF4KG91dHB1dHMubG9naXRzJTJDJTIwZGltJTNELTEpJTVCMCU1RC50b2xpc3QoKSUwQXByZWRpY3Rpb25zJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMuYXJnbWF4KGRpbSUzRC0xKSU1QjAlNUQudG9saXN0KCklMEFwcmludChwcmVkaWN0aW9ucyk=",highlighted:`<span class="hljs-keyword">import</span> torch

probabilities = torch.nn.functional.softmax(outputs.logits, dim=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>].tolist()
predictions = outputs.logits.argmax(dim=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>].tolist()
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){u(i.$$.fragment)},l(p){J(i.$$.fragment,p)},m(p,U){o(i,p,U),m=!0},i(p){m||(M(i.$$.fragment,p),m=!0)},o(p){c(i.$$.fragment,p),m=!1},d(p){j(i,p)}}}function la(x){let i,m,p,U,k,g,z,C,I,$,b,f,r,h,Ve='În această secțiune, vom analiza mai atent capacitățile tokenizerilor din 🤗 Transformers. Până acum, i-am folosit doar pentru tokenizarea inputurilor sau decodificarea ID-urilor înapoi în text, dar tokenizerii - în special cei susținuți de biblioteca 🤗 Tokenizers - pot face mult mai multe. Pentru a ilustra aceste funcții suplimentare, vom explora modul de reproducere a rezultatelor pipeline-urilor <code>token-classification</code> (pe care le-am numit <code>ner</code>) și <code>question-answering</code> pe care le-am întâlnit pentru prima dată în <a href="/course/chapter1">Capitolul 1</a>.',ul,V,Jl,G,Ge='În discuția următoare, vom face adesea distincția între tokenizatori “lenți” și “rapizi”. Tokenizerii lenți sunt cei scriși în Python în interiorul bibliotecii 🤗 Transformers, în timp ce versiunile rapide sunt cele furnizate de 🤗 Tokenizers, care sunt scrise în Rust. Dacă vă amintiți de tabelul din <a href="/course/chapter5/3">Capitolul 5</a> care a raportat cât timp a durat un tokenizer rapid și unul lent pentru a tokeniza datasetul Drug Review, ar trebui să aveți o idee despre de ce îi numim lenți și rapizi:',ol,R,Re='<thead><tr><th align="center"></th> <th align="center">Fast tokenizer</th> <th align="center">Slow tokenizer</th></tr></thead> <tbody><tr><td align="center"><code>batched=True</code></td> <td align="center">10,8s</td> <td align="center">4min41s</td></tr> <tr><td align="center"><code>batched=False</code></td> <td align="center">59,2s</td> <td align="center">5min3s</td></tr></tbody>',jl,E,ml,H,yl,X,Tl,D,He="Rezultatul unui tokenizer nu este un simplu dicționar Python; ceea ce obținem este de fapt un obiect special <code>BatchEncoding</code>. Este o subclasă a unui dicționar (de aceea am putut indexa acel rezultat fără nici o problemă mai devreme), dar cu metode suplimentare care sunt utilizate în principal de către tokenizerii rapizi.",dl,_,Xe="Pe lângă capacitățile lor de paralelizare, funcționalitatea principală a tokenizerilor rapizi este aceea că aceștia țin întotdeauna evidența intervalului original de texte din care provin tokenii finali - o funcționalitate pe care o numim <em>offset mapping</em>. Acest lucru deblochează funcții precum mappingul fiecărui cuvânt la tokens pe care îi generează sau mappingul fiecărui caracter al textului original la tokenul în care se află și invers.",Ul,Y,De="Acum hai să aruncăm o privire la un exemplu:",wl,F,bl,L,_e="Așa cum s-a menționat anterior, în outputul tokenizerului obținem un obiect <code>BatchEncoding</code>:",hl,O,xl,q,Ye="Deoarece clasa <code>AutoTokenizer</code> selectează un tokenizer rapid în mod implicit, putem utiliza metodele suplimentare pe care acest obiect <code>BatchEncoding</code> le oferă. Avem două metode de verificare dacă tokenizerul nostru este unul lent sau rapid. Putem verifica fie atributul <code>is_fast</code> al tokenizer-ului:",Il,P,fl,K,gl,ss,Fe="sau același atribut al <code>encoding</code>:",kl,ls,Cl,es,$l,ns,Le="Hai să vedem ce ne permite un tokenizer rapid să facem. În primul rând, putem accesa tokenul fără a fi nevoie să facem convert ID-urile înapoi în tokens:",zl,as,Bl,ts,Ql,ps,Oe="În acest caz tokenul la indexul 5 este <code>##yl</code>, ceea ce este o parte a cuvântului “Sylvain” în propoziția originală. În același timp putem folosi metoda <code>word_ids()</code> pentru a obține indexul cuvântului din care provine fiecare token:",Zl,is,Al,rs,Sl,cs,Nl,Ms,qe="Așa cum am menționat anterior, toate acestea sunt posibile datorită faptului că tokenizerul rapid ține evidența spanului de text de la care provine fiecare token într-o listă de <em>offseturi</em>. Pentru a ilustra modul în care se utilizează acestea, în continuare vă vom arăta cum să replicați rezultatele pipelineului <code>token-classification</code> manual.",El,W,Wl,us,vl,Js,Pe='În <a href="/course/chapter1">Capitolul 1</a> am avut primul nostru contact aplicând NER - unde sarcina constă în identificarea părților textului care corespund entităților precum persoane, locații sau organizații - cu funcția <code>pipeline()</code> din 🤗 Transformers. Apoi, în <a href="/course/chapter2">Capitolul 2</a>, am văzut cum un pipeline grupează cele trei etape necesare pentru a obține predicțiile de la un text “raw”: tokenizare, trecerea inputurilor prin model și post-procesare. Primele două etape din pipelineul <code>token-classification</code> sunt la fel ca în orice alt pipeline, dar post-procesarea este puțin mai complexă - hai să vedem cum!',Vl,B,Q,pl,os,Gl,js,Ke='În primul rând, trebuie să luăm un token classification pipeline pentru a obține câteva rezultate ca să le putem compara manual. Modelul utilizat în mod implicit este <a href="https://huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english" rel="nofollow"><code>dbmdz/bert-large-cased-finetuned-conll03-english</code></a>; acesta aplică NER pe propoziții:',Rl,ms,Hl,ys,Xl,Ts,sn="Modelul a identificat fiecare token generdat de “Sylvain” ca o persoană, fiecare token generat de “Hugging Face” ca o organizație, și fiecare token “Brooklin” ca o locație”. În același timp putem întreba pipelineul să grupeze împreună tokenurile care corespund cu aceeași entitate.",Dl,ds,_l,Us,Yl,ws,ln="<code>Aggregation_strategy</code> aleasă va modifica scorurile calculate pentru fiecare entitate grupată. Cu <code>&quot;simple&quot;</code>, scorul este doar media scorurilor pentru fiecare token din entitatea dată: de exemplu, scorul pentru “Sylvain” este media scorurilor pe care le-am văzut în exemplele anterioare pentru token-urile <code>S</code>, <code>##yl</code>, <code>##va</code> și <code>##in</code>. Alte strategii disponibile sunt:",Fl,bs,en="<li><code>&quot;first&quot;</code>, unde scorul fiecărei entități este scorul primului token al acelei entități (astfel, pentru “Sylvain” ar fi 0.993828, scorul token-ului <code>S</code>)</li> <li><code>&quot;max&quot;</code>, unde scorul fiecărei entități este scorul maxim al tokenilor din acea entitate (astfel, pentru “Hugging Face” ar fi 0.98879766, scorul “Face”)</li> <li><code>&quot;average&quot;</code>, unde scorul fiecărei entități este media scorurilor cuvintelor care compun acea entitate (astfel, pentru “Sylvain” nu ar exista nicio diferență față de strategia <code>&quot;simple&quot;</code>, dar “Hugging Face” ar avea un scor de 0.9819, media scorurilor pentru “Hugging”, 0.975 și “Face”, 0.98879)</li>",Ll,hs,nn="Acum să vedem cum putem obține aceste rezultate fără a folosi funcția <code>pipeline()</code>!",Ol,xs,ql,Z,A,il,Is,an="Noi avem un batch cu 1 secvență din 19 tokenuri și modelul are 9 labeluri diferite, deci outputul modelului are un shape de 1 x 19 x 9. Ca și pentru text classification pipeline, noi folosim o funcție softmax pentru a face convert logiturilor în probabilități și luăm argmax pentru a obține predicții(atrage atenția asupra fatpului că putem lua argmax pe logituri deoarece softmax nu schimbă ordinea):",Pl,S,N,rl,fs,Kl,gs,tn="Atributul <code>model.config.id2label</code> con;ine mappingul indexilor la labeluri pe care le putem folosi pentru a înțelege predicțiile:",se,ks,le,Cs,ee,$s,pn="Cum am văzut mai devreme, există 9 labeluri: <code>O</code> este labelul pentru tokenurile care nu se află în nicio entitate numită(aceasta reprezintă “exteriorul”), și avem apoi două labeluri pentru fiecare tip de entitate (divers, persoană, organizație și locație). Eticheta <code>B-XXX</code> indică faptul că tokenul se află la începutul entității <code>XXX</code> și eticheta <code>I-XXX</code> indică faptul că tokenul se află în interiorul entității <code>XXX</code>. De exemplu, în exemplul curent ne-am aștepta ca modelul nostru să clasifice tokenul <code>S</code> ca <code>B-PER</code> (începutul unei entități de-tip persoană) și tokenurile <code>##yl</code>, <code>##va</code> și <code>##in</code> ca <code>I-PER</code> (în interiorul unei entități de tip persoană).",ne,zs,rn="S-ar putea să credeți că modelul a greșit în acest caz, deoarece a atribuit eticheta <code>I-PER</code> tuturor acestor patru tokeni, dar acesta nu este în întregime adevărat. Există, de fapt, două formate pentru labelurile <code>B-</code> și <code>I-</code>: <em>IOB1</em> și <em>IOB2</em>. Formatul IOB2 (în roz mai jos), este cel pe care l-am introdus, în timp ce formatul IOB1 (în albastru), utilizează labelurile care încep cu <code>B-</code> doar pentru a separa două entități adiacente de același tip. Modelul pe care îl utilizăm a fost fine-tuned pe un dataset care utilizează acel format, ceea ce explică de ce atribuie labelul <code>I-PER</code> tokenului <code>S</code>.",ae,v,cn='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter6/IOB_versions.svg" alt="IOB1 vs IOB2 format"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter6/IOB_versions-dark.svg" alt="IOB1 vs IOB2 format"/>',te,Bs,Mn="Cu maparea aceasta, suntem gat a să reproducem(aproape în total) rezultat primului pipeline — noi putem lua scorul și labelul fiecărui token care nu a fost clasificat ca <code>O</code>:",pe,Qs,ie,Zs,re,As,un="Acest lucru este foarte similar cu ce am avut mai devreme, cu o excepție: pipelineul de asemenea ne-a oferit informație despre <code>start</code> și <code>end</code> al fiecărei entități în propoziția originală. Acum e momentul când offset mappingul nostru ne va ajuta. Pentru a obține offseturile, noi trebuie să setăm <code>return_offsets_mapping=True</code> când aplicăm tokenizerul pe inputurile noastre:",ce,Ss,Me,Ns,ue,Es,Jn="Fiecare tuple este spanul de text care corespunde fiecărui token, unde <code>(0, 0)</code> este rezervat pentru tokenii speciali. Noi am văzut înainte că tokenul la indexul 5 este <code>##yl</code>, care are aici <code>(12, 14)</code> ca offsets. Dacă luăm sliceul corespunzător în exemplul nostru:",Je,Ws,oe,vs,on="noi obținem spanul propriu de text fără <code>##</code>:",je,Vs,me,Gs,jn="Folosind aceasta, putem acum completa rezultatele anterioare:",ye,Rs,Te,Hs,de,Xs,mn="Acest răspuns e același răspuns pe care l-am primit de la primul pipeline:",Ue,Ds,we,_s,yn="Utilizarea offseturilor pentru a determina cheile de start și de sfârșit pentru fiecare entitate este util, dar această informație nu este strict necesară. Când dorim să grupăm entitățile împreună, totuși, offseturile ne vor salva o mulțime de messy code. De exemplu, dacă am dori să grupăm împreună tokenii <code>Hu</code>, <code>##gging</code> și <code>Face</code>, am putea crea reguli speciale care să spună că primele două ar trebui să fie atașate și să înlăturăm <code>##</code>, iar <code>Face</code> ar trebui adăugat cu un spațiu, deoarece nu începe cu <code>##</code> — dar acest lucru ar funcționa doar pentru acest tip particular de tokenizer. Ar trebui să scriem un alt set de reguli pentru un tokenizer SentencePiece sau unul Byte-Pair-Encoding (discutat mai târziu în acest capitol).",be,Ys,Tn="Cu offseturile, tot acel cod custom dispare: pur și simplu putem lua spanul din textul original care începe cu primul token și se termină cu ultimul token. Deci, în cazul tokenurilor <code>Hu</code>, <code>##gging</code> și <code>Face</code>, ar trebui să începem la caracterul 33 (începutul lui <code>Hu</code>) și să ne oprim înainte de caracterul 45 (sfârșitul lui <code>Face</code>):",he,Fs,xe,Ls,Ie,Os,dn="Pentru a scrie codul care post-procesează predicțiile în timp ce grupăm entitățile, vom grupa entitățile care sunt consecutive și labeled cu <code>I-XXX</code>, cu excepția primeia, care poate fi labeled ca <code>B-XXX</code> sau <code>I-XXX</code> (decidem să oprim gruparea unei entități atunci când întâlnim un <code>O</code>, un nou tip de entitate, sau un <code>B-XXX</code> care ne spune că o entitate de același tip începe):",fe,qs,ge,Ps,Un="Și obținem aceleași răspuns ca de la pipelineul secundar!",ke,Ks,Ce,sl,wn="Alt exemplu de sarcină unde offseturile sunt extrem de useful pentru răspunderea la întrebări. Scufundându-ne în pipelineuri, un lucru pe care îl vom face în următoarea secțiune, ne vom premite să ne uităm peste o caracteristică a tokenizerului în librăria 🤗 Transformers: vom avea de-a face cu overflowing tokens când truncăm un input de o anumită lungime.",$e,ll,ze,Ml,Be;k=new Xn({props:{fw:x[0]}}),z=new Rn({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),I=new cl({props:{title:"Superputerile tokenizerilor rapizi",local:"fast-tokenizers-special-powers",headingTag:"h1"}});const bn=[_n,Dn],el=[];function hn(s,l){return s[0]==="pt"?0:1}b=hn(x),f=el[b]=bn[b](x),V=new Ae({props:{id:"g8quOxoqhHQ"}}),E=new Zn({props:{warning:!0,$$slots:{default:[Yn]},$$scope:{ctx:x}}}),H=new cl({props:{title:"Batch encoding",local:"batch-encoding",headingTag:"h2"}}),X=new Ae({props:{id:"3umI3tm27Vw"}}),F=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtY2FzZWQlMjIpJTBBZXhhbXBsZSUyMCUzRCUyMCUyMk15JTIwbmFtZSUyMGlzJTIwU3lsdmFpbiUyMGFuZCUyMEklMjB3b3JrJTIwYXQlMjBIdWdnaW5nJTIwRmFjZSUyMGluJTIwQnJvb2tseW4uJTIyJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoZXhhbXBsZSklMEFwcmludCh0eXBlKGVuY29kaW5nKSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
example = <span class="hljs-string">&quot;My name is Sylvain and I work at Hugging Face in Brooklyn.&quot;</span>
encoding = tokenizer(example)
<span class="hljs-built_in">print</span>(<span class="hljs-built_in">type</span>(encoding))`,wrap:!1}}),O=new w({props:{code:"JTNDY2xhc3MlMjAndHJhbnNmb3JtZXJzLnRva2VuaXphdGlvbl91dGlsc19iYXNlLkJhdGNoRW5jb2RpbmcnJTNF",highlighted:'&lt;<span class="hljs-keyword">class</span> <span class="hljs-string">&#x27;transformers.tokenization_utils_base.BatchEncoding&#x27;</span>&gt;',wrap:!1}}),P=new w({props:{code:"dG9rZW5pemVyLmlzX2Zhc3Q=",highlighted:"tokenizer.is_fast",wrap:!1}}),K=new w({props:{code:"VHJ1ZQ==",highlighted:'<span class="hljs-literal">True</span>',wrap:!1}}),ls=new w({props:{code:"ZW5jb2RpbmcuaXNfZmFzdA==",highlighted:"encoding.is_fast",wrap:!1}}),es=new w({props:{code:"VHJ1ZQ==",highlighted:'<span class="hljs-literal">True</span>',wrap:!1}}),as=new w({props:{code:"ZW5jb2RpbmcudG9rZW5zKCk=",highlighted:"encoding.tokens()",wrap:!1}}),ts=new w({props:{code:"JTVCJyU1QkNMUyU1RCclMkMlMjAnTXknJTJDJTIwJ25hbWUnJTJDJTIwJ2lzJyUyQyUyMCdTJyUyQyUyMCclMjMlMjN5bCclMkMlMjAnJTIzJTIzdmEnJTJDJTIwJyUyMyUyM2luJyUyQyUyMCdhbmQnJTJDJTIwJ0knJTJDJTIwJ3dvcmsnJTJDJTIwJ2F0JyUyQyUyMCdIdSclMkMlMjAnJTIzJTIzZ2dpbmcnJTJDJTIwJ0ZhY2UnJTJDJTIwJ2luJyUyQyUwQSUyMCdCcm9va2x5biclMkMlMjAnLiclMkMlMjAnJTVCU0VQJTVEJyU1RA==",highlighted:`[<span class="hljs-string">&#x27;[CLS]&#x27;</span>, <span class="hljs-string">&#x27;My&#x27;</span>, <span class="hljs-string">&#x27;name&#x27;</span>, <span class="hljs-string">&#x27;is&#x27;</span>, <span class="hljs-string">&#x27;S&#x27;</span>, <span class="hljs-string">&#x27;##yl&#x27;</span>, <span class="hljs-string">&#x27;##va&#x27;</span>, <span class="hljs-string">&#x27;##in&#x27;</span>, <span class="hljs-string">&#x27;and&#x27;</span>, <span class="hljs-string">&#x27;I&#x27;</span>, <span class="hljs-string">&#x27;work&#x27;</span>, <span class="hljs-string">&#x27;at&#x27;</span>, <span class="hljs-string">&#x27;Hu&#x27;</span>, <span class="hljs-string">&#x27;##gging&#x27;</span>, <span class="hljs-string">&#x27;Face&#x27;</span>, <span class="hljs-string">&#x27;in&#x27;</span>,
 <span class="hljs-string">&#x27;Brooklyn&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;[SEP]&#x27;</span>]`,wrap:!1}}),is=new w({props:{code:"ZW5jb2Rpbmcud29yZF9pZHMoKQ==",highlighted:"encoding.word_ids()",wrap:!1}}),rs=new w({props:{code:" ",highlighted:'[<span class="hljs-literal">None</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">3</span>, <span class="hljs-number">3</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">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>, <span class="hljs-number">11</span>, <span class="hljs-number">12</span>, <span class="hljs-literal">None</span>]\n\nPutem vedea că tokenizerul are tokeni speciali `[CLS]` și `[SEP]` care sunt mapped la `<span class="hljs-literal">None</span>`, iar apoi fiecare token este mapped la cuvântul din care provine. Acest lucru este deosebit de util pentru a determina dacă un token este la începutul unui cuvânt sau dacă două tokenuri sunt în același cuvânt. Ne-am putea baza pe prefixul `<span class="hljs-comment">##` pentru aceasta, dar funcționează doar pentru tokenizeri de tip BERT; această metodă funcționează pentru orice tip de tokenizator, atâta timp cât este unul rapid. În capitolul următor, vom vedea cum putem utiliza această capabilitate pentru a aplica labeluri pe care le avem pentru fiecare cuvânt în mod corespunzător tokenurilor în sarcini precum named entity recognition (NER) și part-of-speech (POS). De asemenea, îl putem utiliza pentru a face mask tuturor tokenurilor care provin din același cuvânt în masked language modeling(o tehnică numită _whole word masking_).</span>\n\n&lt;Tip&gt;\n\nNoțiunea de ceea ce este un cuvânt este complicată. De exemplu, <span class="hljs-string">&quot;I&#x27;ll&quot;</span> (o prescurtare a <span class="hljs-string">&quot;I will&quot;</span>) contează ca unul sau două cuvinte? Acest lucru depinde de tokenizer și de operațiunea de pre-tokenizare pe care o aplică. Unii tokenizeri se divid doar pe spații, așa că vor considera acest lucru ca un singur cuvânt. Alții folosesc punctuația pe lângă spații, deci vor considera două cuvinte.\n\n✏️ **Încercați!** Creați un tokenizer din checkpointurile `bert-base-cased` și `roberta-base` și tokenizați <span class="hljs-string">&quot;81s&quot;</span> cu ele. Ce observați? Care sunt ID-urile cuvintelor?\n\n&lt;/Tip&gt;\n\nÎn mod similar, există o metodă `sentence_ids()` pe care o putem utiliza pentru a face <span class="hljs-built_in">map</span> unui token la propoziția din care provine (deși, în acest caz, `token_type_ids` returnate de tokenizer ne pot oferi aceeași informație).\n\nÎn cele din urmă, putem face <span class="hljs-built_in">map</span> oricărui cuvânt sau token la caracterele din textul original și invers, prin intermediul metodelor `word_to_chars()` sau `token_to_chars()` și `char_to_word()` sau `char_to_token()`. De exemplu, metoda `word_ids()` ne-a spus că `<span class="hljs-comment">##yl` face parte din cuvântul cu indicele 3, dar ce cuvânt este în propoziție? Putem afla astfel:</span>\n\n```py\nstart, end = encoding.word_to_chars(<span class="hljs-number">3</span>)\nexample[start:end]',wrap:!1}}),cs=new w({props:{code:"U3lsdmFpbg==",highlighted:"Sylvain",wrap:!1}}),W=new Zn({props:{$$slots:{default:[Fn]},$$scope:{ctx:x}}}),us=new cl({props:{title:"În interiorul pipelineului token-classification",local:"inside-the-token-classification-pipeline",headingTag:"h2"}});const xn=[On,Ln],nl=[];function In(s,l){return s[0]==="pt"?0:1}B=In(x),Q=nl[B]=xn[B](x),os=new cl({props:{title:"Obținerea rezultatelor de bază cu pipelineul",local:"getting-the-base-results-with-the-pipeline",headingTag:"h3"}}),ms=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdG9rZW5fY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnRva2VuLWNsYXNzaWZpY2F0aW9uJTIyKSUwQXRva2VuX2NsYXNzaWZpZXIoJTIyTXklMjBuYW1lJTIwaXMlMjBTeWx2YWluJTIwYW5kJTIwSSUyMHdvcmslMjBhdCUyMEh1Z2dpbmclMjBGYWNlJTIwaW4lMjBCcm9va2x5bi4lMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

token_classifier = pipeline(<span class="hljs-string">&quot;token-classification&quot;</span>)
token_classifier(<span class="hljs-string">&quot;My name is Sylvain and I work at Hugging Face in Brooklyn.&quot;</span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RpdHknJTNBJTIwJ0ktT1JHJyUyQyUyMCdzY29yZSclM0ElMjAwLjk3NjExNSUyQyUyMCdpbmRleCclM0ElMjAxMyUyQyUyMCd3b3JkJyUzQSUyMCclMjMlMjNnZ2luZyclMkMlMjAnc3RhcnQnJTNBJTIwMzUlMkMlMjAnZW5kJyUzQSUyMDQwJTdEJTJDJTBBJTIwJTdCJ2VudGl0eSclM0ElMjAnSS1PUkcnJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTg4Nzk3NjYlMkMlMjAnaW5kZXgnJTNBJTIwMTQlMkMlMjAnd29yZCclM0ElMjAnRmFjZSclMkMlMjAnc3RhcnQnJTNBJTIwNDElMkMlMjAnZW5kJyUzQSUyMDQ1JTdEJTJDJTBBJTIwJTdCJ2VudGl0eSclM0ElMjAnSS1MT0MnJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTkzMjEwNTUlMkMlMjAnaW5kZXgnJTNBJTIwMTYlMkMlMjAnd29yZCclM0ElMjAnQnJvb2tseW4nJTJDJTIwJ3N0YXJ0JyUzQSUyMDQ5JTJDJTIwJ2VuZCclM0ElMjA1NyU3RCU1RA==",highlighted:`[{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9993828</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">4</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;S&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">11</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">12</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99815476</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">5</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##yl&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">14</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99590725</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">6</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##va&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">14</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">16</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9992327</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">7</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##in&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">18</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97389334</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hu&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">33</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">35</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.976115</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">13</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##gging&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">35</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">40</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.98879766</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">14</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Face&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">41</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99321055</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Brooklyn&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">49</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">57</span>}]`,wrap:!1}}),ds=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdG9rZW5fY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnRva2VuLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwYWdncmVnYXRpb25fc3RyYXRlZ3klM0QlMjJzaW1wbGUlMjIpJTBBdG9rZW5fY2xhc3NpZmllciglMjJNeSUyMG5hbWUlMjBpcyUyMFN5bHZhaW4lMjBhbmQlMjBJJTIwd29yayUyMGF0JTIwSHVnZ2luZyUyMEZhY2UlMjBpbiUyMEJyb29rbHluLiUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

token_classifier = pipeline(<span class="hljs-string">&quot;token-classification&quot;</span>, aggregation_strategy=<span class="hljs-string">&quot;simple&quot;</span>)
token_classifier(<span class="hljs-string">&quot;My name is Sylvain and I work at Hugging Face in Brooklyn.&quot;</span>)`,wrap:!1}}),Us=new w({props:{code:"JTVCJTdCJ2VudGl0eV9ncm91cCclM0ElMjAnUEVSJyUyQyUyMCdzY29yZSclM0ElMjAwLjk5ODE2OTQlMkMlMjAnd29yZCclM0ElMjAnU3lsdmFpbiclMkMlMjAnc3RhcnQnJTNBJTIwMTElMkMlMjAnZW5kJyUzQSUyMDE4JTdEJTJDJTBBJTIwJTdCJ2VudGl0eV9ncm91cCclM0ElMjAnT1JHJyUyQyUyMCdzY29yZSclM0ElMjAwLjk3OTYwMjA0JTJDJTIwJ3dvcmQnJTNBJTIwJ0h1Z2dpbmclMjBGYWNlJyUyQyUyMCdzdGFydCclM0ElMjAzMyUyQyUyMCdlbmQnJTNBJTIwNDUlN0QlMkMlMEElMjAlN0InZW50aXR5X2dyb3VwJyUzQSUyMCdMT0MnJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTkzMjEwNTUlMkMlMjAnd29yZCclM0ElMjAnQnJvb2tseW4nJTJDJTIwJ3N0YXJ0JyUzQSUyMDQ5JTJDJTIwJ2VuZCclM0ElMjA1NyU3RCU1RA==",highlighted:`[{<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9981694</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Sylvain&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">11</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">18</span>},
 {<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97960204</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hugging Face&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">33</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>},
 {<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99321055</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Brooklyn&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">49</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">57</span>}]`,wrap:!1}}),xs=new cl({props:{title:"De la inputuri la predicții",local:"from-inputs-to-predictions",headingTag:"h3"}});const fn=[Pn,qn],al=[];function gn(s,l){return s[0]==="pt"?0:1}Z=gn(x),A=al[Z]=fn[Z](x);const kn=[sa,Kn],tl=[];function Cn(s,l){return s[0]==="pt"?0:1}return S=Cn(x),N=tl[S]=kn[S](x),fs=new w({props:{code:"JTVCMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDQlMkMlMjA0JTJDJTIwNCUyQyUyMDQlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwNiUyQyUyMDYlMkMlMjA2JTJDJTIwMCUyQyUyMDglMkMlMjAwJTJDJTIwMCU1RA==",highlighted:'[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">6</span>, <span class="hljs-number">6</span>, <span class="hljs-number">6</span>, <span class="hljs-number">0</span>, <span class="hljs-number">8</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]',wrap:!1}}),ks=new w({props:{code:"bW9kZWwuY29uZmlnLmlkMmxhYmVs",highlighted:"model.config.id2label",wrap:!1}}),Cs=new w({props:{code:"JTdCMCUzQSUyMCdPJyUyQyUwQSUyMDElM0ElMjAnQi1NSVNDJyUyQyUwQSUyMDIlM0ElMjAnSS1NSVNDJyUyQyUwQSUyMDMlM0ElMjAnQi1QRVInJTJDJTBBJTIwNCUzQSUyMCdJLVBFUiclMkMlMEElMjA1JTNBJTIwJ0ItT1JHJyUyQyUwQSUyMDYlM0ElMjAnSS1PUkcnJTJDJTBBJTIwNyUzQSUyMCdCLUxPQyclMkMlMEElMjA4JTNBJTIwJ0ktTE9DJyU3RA==",highlighted:`{<span class="hljs-number">0</span>: <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-number">1</span>: <span class="hljs-string">&#x27;B-MISC&#x27;</span>,
 <span class="hljs-number">2</span>: <span class="hljs-string">&#x27;I-MISC&#x27;</span>,
 <span class="hljs-number">3</span>: <span class="hljs-string">&#x27;B-PER&#x27;</span>,
 <span class="hljs-number">4</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>,
 <span class="hljs-number">5</span>: <span class="hljs-string">&#x27;B-ORG&#x27;</span>,
 <span class="hljs-number">6</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>,
 <span class="hljs-number">7</span>: <span class="hljs-string">&#x27;B-LOC&#x27;</span>,
 <span class="hljs-number">8</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>}`,wrap:!1}}),Qs=new w({props:{code:"cmVzdWx0cyUyMCUzRCUyMCU1QiU1RCUwQXRva2VucyUyMCUzRCUyMGlucHV0cy50b2tlbnMoKSUwQSUwQWZvciUyMGlkeCUyQyUyMHByZWQlMjBpbiUyMGVudW1lcmF0ZShwcmVkaWN0aW9ucyklM0ElMEElMjAlMjAlMjAlMjBsYWJlbCUyMCUzRCUyMG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWQlNUQlMEElMjAlMjAlMjAlMjBpZiUyMGxhYmVsJTIwISUzRCUyMCUyMk8lMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXN1bHRzLmFwcGVuZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0IlMjJlbnRpdHklMjIlM0ElMjBsYWJlbCUyQyUyMCUyMnNjb3JlJTIyJTNBJTIwcHJvYmFiaWxpdGllcyU1QmlkeCU1RCU1QnByZWQlNUQlMkMlMjAlMjJ3b3JkJTIyJTNBJTIwdG9rZW5zJTVCaWR4JTVEJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQXByaW50KHJlc3VsdHMp",highlighted:`results = []
tokens = inputs.tokens()

<span class="hljs-keyword">for</span> idx, pred <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(predictions):
    label = model.config.id2label[pred]
    <span class="hljs-keyword">if</span> label != <span class="hljs-string">&quot;O&quot;</span>:
        results.append(
            {<span class="hljs-string">&quot;entity&quot;</span>: label, <span class="hljs-string">&quot;score&quot;</span>: probabilities[idx][pred], <span class="hljs-string">&quot;word&quot;</span>: tokens[idx]}
        )

<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),Zs=new w({props:{code:"JTVCJTdCJ2VudGl0eSclM0ElMjAnSS1QRVInJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTk5MzgyOCUyQyUyMCdpbmRleCclM0ElMjA0JTJDJTIwJ3dvcmQnJTNBJTIwJ1MnJTdEJTJDJTBBJTIwJTdCJ2VudGl0eSclM0ElMjAnSS1QRVInJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTk4MTU0NzYlMkMlMjAnaW5kZXgnJTNBJTIwNSUyQyUyMCd3b3JkJyUzQSUyMCclMjMlMjN5bCclN0QlMkMlMEElMjAlN0InZW50aXR5JyUzQSUyMCdJLVBFUiclMkMlMjAnc2NvcmUnJTNBJTIwMC45OTU5MDcyNSUyQyUyMCdpbmRleCclM0ElMjA2JTJDJTIwJ3dvcmQnJTNBJTIwJyUyMyUyM3ZhJyU3RCUyQyUwQSUyMCU3QidlbnRpdHknJTNBJTIwJ0ktUEVSJyUyQyUyMCdzY29yZSclM0ElMjAwLjk5OTIzMjclMkMlMjAnaW5kZXgnJTNBJTIwNyUyQyUyMCd3b3JkJyUzQSUyMCclMjMlMjNpbiclN0QlMkMlMEElMjAlN0InZW50aXR5JyUzQSUyMCdJLU9SRyclMkMlMjAnc2NvcmUnJTNBJTIwMC45NzM4OTMzNCUyQyUyMCdpbmRleCclM0ElMjAxMiUyQyUyMCd3b3JkJyUzQSUyMCdIdSclN0QlMkMlMEElMjAlN0InZW50aXR5JyUzQSUyMCdJLU9SRyclMkMlMjAnc2NvcmUnJTNBJTIwMC45NzYxMTUlMkMlMjAnaW5kZXgnJTNBJTIwMTMlMkMlMjAnd29yZCclM0ElMjAnJTIzJTIzZ2dpbmcnJTdEJTJDJTBBJTIwJTdCJ2VudGl0eSclM0ElMjAnSS1PUkcnJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTg4Nzk3NjYlMkMlMjAnaW5kZXgnJTNBJTIwMTQlMkMlMjAnd29yZCclM0ElMjAnRmFjZSclN0QlMkMlMEElMjAlN0InZW50aXR5JyUzQSUyMCdJLUxPQyclMkMlMjAnc2NvcmUnJTNBJTIwMC45OTMyMTA1NSUyQyUyMCdpbmRleCclM0ElMjAxNiUyQyUyMCd3b3JkJyUzQSUyMCdCcm9va2x5biclN0QlNUQ=",highlighted:`[{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9993828</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">4</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;S&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99815476</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">5</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##yl&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99590725</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">6</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##va&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9992327</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">7</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##in&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97389334</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hu&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.976115</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">13</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##gging&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.98879766</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">14</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Face&#x27;</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99321055</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Brooklyn&#x27;</span>}]`,wrap:!1}}),Ss=new w({props:{code:"aW5wdXRzX3dpdGhfb2Zmc2V0cyUyMCUzRCUyMHRva2VuaXplcihleGFtcGxlJTJDJTIwcmV0dXJuX29mZnNldHNfbWFwcGluZyUzRFRydWUpJTBBaW5wdXRzX3dpdGhfb2Zmc2V0cyU1QiUyMm9mZnNldF9tYXBwaW5nJTIyJTVE",highlighted:`inputs_with_offsets = tokenizer(example, return_offsets_mapping=<span class="hljs-literal">True</span>)
inputs_with_offsets[<span class="hljs-string">&quot;offset_mapping&quot;</span>]`,wrap:!1}}),Ns=new w({props:{code:"JTVCKDAlMkMlMjAwKSUyQyUyMCgwJTJDJTIwMiklMkMlMjAoMyUyQyUyMDcpJTJDJTIwKDglMkMlMjAxMCklMkMlMjAoMTElMkMlMjAxMiklMkMlMjAoMTIlMkMlMjAxNCklMkMlMjAoMTQlMkMlMjAxNiklMkMlMjAoMTYlMkMlMjAxOCklMkMlMjAoMTklMkMlMjAyMiklMkMlMjAoMjMlMkMlMjAyNCklMkMlMjAoMjUlMkMlMjAyOSklMkMlMjAoMzAlMkMlMjAzMiklMkMlMEElMjAoMzMlMkMlMjAzNSklMkMlMjAoMzUlMkMlMjA0MCklMkMlMjAoNDElMkMlMjA0NSklMkMlMjAoNDYlMkMlMjA0OCklMkMlMjAoNDklMkMlMjA1NyklMkMlMjAoNTclMkMlMjA1OCklMkMlMjAoMCUyQyUyMDApJTVE",highlighted:`[(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>), (<span class="hljs-number">0</span>, <span class="hljs-number">2</span>), (<span class="hljs-number">3</span>, <span class="hljs-number">7</span>), (<span class="hljs-number">8</span>, <span class="hljs-number">10</span>), (<span class="hljs-number">11</span>, <span class="hljs-number">12</span>), (<span class="hljs-number">12</span>, <span class="hljs-number">14</span>), (<span class="hljs-number">14</span>, <span class="hljs-number">16</span>), (<span class="hljs-number">16</span>, <span class="hljs-number">18</span>), (<span class="hljs-number">19</span>, <span class="hljs-number">22</span>), (<span class="hljs-number">23</span>, <span class="hljs-number">24</span>), (<span class="hljs-number">25</span>, <span class="hljs-number">29</span>), (<span class="hljs-number">30</span>, <span class="hljs-number">32</span>),
 (<span class="hljs-number">33</span>, <span class="hljs-number">35</span>), (<span class="hljs-number">35</span>, <span class="hljs-number">40</span>), (<span class="hljs-number">41</span>, <span class="hljs-number">45</span>), (<span class="hljs-number">46</span>, <span class="hljs-number">48</span>), (<span class="hljs-number">49</span>, <span class="hljs-number">57</span>), (<span class="hljs-number">57</span>, <span class="hljs-number">58</span>), (<span class="hljs-number">0</span>, <span class="hljs-number">0</span>)]`,wrap:!1}}),Ws=new w({props:{code:"ZXhhbXBsZSU1QjEyJTNBMTQlNUQ=",highlighted:'example[<span class="hljs-number">12</span>:<span class="hljs-number">14</span>]',wrap:!1}}),Vs=new w({props:{code:"eWw=",highlighted:"yl",wrap:!1}}),Rs=new w({props:{code:"cmVzdWx0cyUyMCUzRCUyMCU1QiU1RCUwQWlucHV0c193aXRoX29mZnNldHMlMjAlM0QlMjB0b2tlbml6ZXIoZXhhbXBsZSUyQyUyMHJldHVybl9vZmZzZXRzX21hcHBpbmclM0RUcnVlKSUwQXRva2VucyUyMCUzRCUyMG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wJTIwJTIwJTIwJTIwJTIwJTIwJTIyZW5kJTIyJTNBJTIwZW5kJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUwQXByaW50KHJlc3VsdHMp",highlighted:`results = []
inputs_with_offsets = tokenizer(example, return_offsets_mapping=<span class="hljs-literal">True</span>)
tokens = inputs_with_offsets.tokens()
offsets = inputs_with_offsets[<span class="hljs-string">&quot;offset_mapping&quot;</span>]

<span class="hljs-keyword">for</span> idx, pred <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(predictions):
    label = model.config.id2label[pred]
    <span class="hljs-keyword">if</span> label != <span class="hljs-string">&quot;O&quot;</span>:
        start, end = offsets[idx]
        results.append(
            {
                <span class="hljs-string">&quot;entity&quot;</span>: label,
                <span class="hljs-string">&quot;score&quot;</span>: probabilities[idx][pred],
                <span class="hljs-string">&quot;word&quot;</span>: tokens[idx],
                <span class="hljs-string">&quot;start&quot;</span>: start,
                <span class="hljs-string">&quot;end&quot;</span>: end,
            }
        )

<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),Hs=new w({props:{code:"JTVCJTdCJ2VudGl0eSclM0ElMjAnSS1QRVInJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTk5MzgyOCUyQyUyMCdpbmRleCclM0ElMjA0JTJDJTIwJ3dvcmQnJTNBJTIwJ1MnJTJDJTIwJ3N0YXJ0JyUzQSUyMDExJTJDJTIwJ2VuZCclM0ElMjAxMiU3RCUyQyUwQSUyMCU3QidlbnRpdHknJTNBJTIwJ0ktUEVSJyUyQyUyMCdzY29yZSclM0ElMjAwLjk5ODE1NDc2JTJDJTIwJ2luZGV4JyUzQSUyMDUlMkMlMjAnd29yZCclM0ElMjAnJTIzJTIzeWwnJTJDJTIwJ3N0YXJ0JyUzQSUyMDEyJTJDJTIwJ2VuZCclM0ElMjAxNCU3RCUyQyUwQ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nJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTkzMjEwNTUlMkMlMjAnaW5kZXgnJTNBJTIwMTYlMkMlMjAnd29yZCclM0ElMjAnQnJvb2tseW4nJTJDJTIwJ3N0YXJ0JyUzQSUyMDQ5JTJDJTIwJ2VuZCclM0ElMjA1NyU3RCU1RA==",highlighted:`[{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9993828</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">4</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;S&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">11</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">12</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99815476</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">5</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##yl&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">14</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99590725</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">6</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##va&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">14</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">16</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9992327</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">7</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##in&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">18</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97389334</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hu&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">33</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">35</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.976115</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">13</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##gging&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">35</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">40</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.98879766</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">14</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Face&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">41</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99321055</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Brooklyn&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">49</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">57</span>}]`,wrap:!1}}),Ds=new cl({props:{title:"Gruparea entităților",local:"grouping-entities",headingTag:"h3"}}),Fs=new w({props:{code:"ZXhhbXBsZSU1QjMzJTNBNDUlNUQ=",highlighted:'example[<span class="hljs-number">33</span>:<span class="hljs-number">45</span>]',wrap:!1}}),Ls=new w({props:{code:"SHVnZ2luZyUyMEZhY2U=",highlighted:"Hugging Face",wrap:!1}}),qs=new w({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcmVzdWx0cyUyMCUzRCUyMCU1QiU1RCUwQWlucHV0c193aXRoX29mZnNldHMlMjAlM0QlMjB0b2tlbml6ZXIoZXhhbXBsZSUyQyUyMHJldHVybl9vZmZzZXRzX21hcHBpbmclM0RUcnVlKSUwQXRva2VucyUyMCUzRCUyMGlucHV0c193aXRoX29mZnNldHMudG9rZW5zKCklMEFvZmZzZXRzJTIwJTNEJTIwaW5wdXRzX3dpdGhfb2Zmc2V0cyU1QiUyMm9mZnNldF9tYXBwaW5nJTIyJTVEJTBBJTBBaWR4JTIwJTNEJTIwMCUwQXdoaWxlJTIwaWR4JTIwJTNDJTIwbGVuKHByZWRpY3Rpb25zKSUzQSUwQSUyMCUyMCUyMCUyMHByZWQlMjAlM0QlMjBwcmVkaWN0aW9ucyU1QmlkeCU1RCUwQSUyMCUyMCUyMCUyMGxhYmVsJTIwJTNEJTIwbW9k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IwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyZW5kJTIyJTNBJTIwZW5kJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMGlkeCUyMCUyQiUzRCUyMDElMEElMEFwcmludChyZXN1bHRzKQ==",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

results = []
inputs_with_offsets = tokenizer(example, return_offsets_mapping=<span class="hljs-literal">True</span>)
tokens = inputs_with_offsets.tokens()
offsets = inputs_with_offsets[<span class="hljs-string">&quot;offset_mapping&quot;</span>]

idx = <span class="hljs-number">0</span>
<span class="hljs-keyword">while</span> idx &lt; <span class="hljs-built_in">len</span>(predictions):
    pred = predictions[idx]
    label = model.config.id2label[pred]
    <span class="hljs-keyword">if</span> label != <span class="hljs-string">&quot;O&quot;</span>:
        <span class="hljs-comment"># Remove the B- or I-</span>
        label = label[<span class="hljs-number">2</span>:]
        start, _ = offsets[idx]

        <span class="hljs-comment"># Grab all the tokens labeled with I-label</span>
        all_scores = []
        <span class="hljs-keyword">while</span> (
            idx &lt; <span class="hljs-built_in">len</span>(predictions)
            <span class="hljs-keyword">and</span> model.config.id2label[predictions[idx]] == <span class="hljs-string">f&quot;I-<span class="hljs-subst">{label}</span>&quot;</span>
        ):
            all_scores.append(probabilities[idx][pred])
            _, end = offsets[idx]
            idx += <span class="hljs-number">1</span>

        <span class="hljs-comment"># The score is the mean of all the scores of the tokens in that grouped entity</span>
        score = np.mean(all_scores).item()
        word = example[start:end]
        results.append(
            {
                <span class="hljs-string">&quot;entity_group&quot;</span>: label,
                <span class="hljs-string">&quot;score&quot;</span>: score,
                <span class="hljs-string">&quot;word&quot;</span>: word,
                <span class="hljs-string">&quot;start&quot;</span>: start,
                <span class="hljs-string">&quot;end&quot;</span>: end,
            }
        )
    idx += <span class="hljs-number">1</span>

<span class="hljs-built_in">print</span>(results)`,wrap:!1}}),Ks=new w({props:{code:"JTVCJTdCJ2VudGl0eV9ncm91cCclM0ElMjAnUEVSJyUyQyUyMCdzY29yZSclM0ElMjAwLjk5ODE2OTQlMkMlMjAnd29yZCclM0ElMjAnU3lsdmFpbiclMkMlMjAnc3RhcnQnJTNBJTIwMTElMkMlMjAnZW5kJyUzQSUyMDE4JTdEJTJDJTBBJTIwJTdCJ2VudGl0eV9ncm91cCclM0ElMjAnT1JHJyUyQyUyMCdzY29yZSclM0ElMjAwLjk3OTYwMjA0JTJDJTIwJ3dvcmQnJTNBJTIwJ0h1Z2dpbmclMjBGYWNlJyUyQyUyMCdzdGFydCclM0ElMjAzMyUyQyUyMCdlbmQnJTNBJTIwNDUlN0QlMkMlMEElMjAlN0InZW50aXR5X2dyb3VwJyUzQSUyMCdMT0MnJTJDJTIwJ3Njb3JlJyUzQSUyMDAuOTkzMjEwNTUlMkMlMjAnd29yZCclM0ElMjAnQnJvb2tseW4nJTJDJTIwJ3N0YXJ0JyUzQSUyMDQ5JTJDJTIwJ2VuZCclM0ElMjA1NyU3RCU1RA==",highlighted:`[{<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;PER&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9981694</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Sylvain&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">11</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">18</span>},
 {<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97960204</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hugging Face&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">33</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>},
 {<span class="hljs-string">&#x27;entity_group&#x27;</span>: <span class="hljs-string">&#x27;LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.99321055</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Brooklyn&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">49</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">57</span>}]`,wrap:!1}}),ll=new Hn({props:{source:"https://github.com/huggingface/course/blob/main/chapters/ro/chapter6/3.mdx"}}),{c(){i=y("meta"),m=a(),p=y("p"),U=a(),u(k.$$.fragment),g=a(),u(z.$$.fragment),C=a(),u(I.$$.fragment),$=a(),f.c(),r=a(),h=y("p"),h.innerHTML=Ve,ul=a(),u(V.$$.fragment),Jl=a(),G=y("p"),G.innerHTML=Ge,ol=a(),R=y("table"),R.innerHTML=Re,jl=a(),u(E.$$.fragment),ml=a(),u(H.$$.fragment),yl=a(),u(X.$$.fragment),Tl=a(),D=y("p"),D.innerHTML=He,dl=a(),_=y("p"),_.innerHTML=Xe,Ul=a(),Y=y("p"),Y.textContent=De,wl=a(),u(F.$$.fragment),bl=a(),L=y("p"),L.innerHTML=_e,hl=a(),u(O.$$.fragment),xl=a(),q=y("p"),q.innerHTML=Ye,Il=a(),u(P.$$.fragment),fl=a(),u(K.$$.fragment),gl=a(),ss=y("p"),ss.innerHTML=Fe,kl=a(),u(ls.$$.fragment),Cl=a(),u(es.$$.fragment),$l=a(),ns=y("p"),ns.textContent=Le,zl=a(),u(as.$$.fragment),Bl=a(),u(ts.$$.fragment),Ql=a(),ps=y("p"),ps.innerHTML=Oe,Zl=a(),u(is.$$.fragment),Al=a(),u(rs.$$.fragment),Sl=a(),u(cs.$$.fragment),Nl=a(),Ms=y("p"),Ms.innerHTML=qe,El=a(),u(W.$$.fragment),Wl=a(),u(us.$$.fragment),vl=a(),Js=y("p"),Js.innerHTML=Pe,Vl=a(),Q.c(),pl=a(),u(os.$$.fragment),Gl=a(),js=y("p"),js.innerHTML=Ke,Rl=a(),u(ms.$$.fragment),Hl=a(),u(ys.$$.fragment),Xl=a(),Ts=y("p"),Ts.textContent=sn,Dl=a(),u(ds.$$.fragment),_l=a(),u(Us.$$.fragment),Yl=a(),ws=y("p"),ws.innerHTML=ln,Fl=a(),bs=y("ul"),bs.innerHTML=en,Ll=a(),hs=y("p"),hs.innerHTML=nn,Ol=a(),u(xs.$$.fragment),ql=a(),A.c(),il=a(),Is=y("p"),Is.textContent=an,Pl=a(),N.c(),rl=a(),u(fs.$$.fragment),Kl=a(),gs=y("p"),gs.innerHTML=tn,se=a(),u(ks.$$.fragment),le=a(),u(Cs.$$.fragment),ee=a(),$s=y("p"),$s.innerHTML=pn,ne=a(),zs=y("p"),zs.innerHTML=rn,ae=a(),v=y("div"),v.innerHTML=cn,te=a(),Bs=y("p"),Bs.innerHTML=Mn,pe=a(),u(Qs.$$.fragment),ie=a(),u(Zs.$$.fragment),re=a(),As=y("p"),As.innerHTML=un,ce=a(),u(Ss.$$.fragment),Me=a(),u(Ns.$$.fragment),ue=a(),Es=y("p"),Es.innerHTML=Jn,Je=a(),u(Ws.$$.fragment),oe=a(),vs=y("p"),vs.innerHTML=on,je=a(),u(Vs.$$.fragment),me=a(),Gs=y("p"),Gs.textContent=jn,ye=a(),u(Rs.$$.fragment),Te=a(),u(Hs.$$.fragment),de=a(),Xs=y("p"),Xs.textContent=mn,Ue=a(),u(Ds.$$.fragment),we=a(),_s=y("p"),_s.innerHTML=yn,be=a(),Ys=y("p"),Ys.innerHTML=Tn,he=a(),u(Fs.$$.fragment),xe=a(),u(Ls.$$.fragment),Ie=a(),Os=y("p"),Os.innerHTML=dn,fe=a(),u(qs.$$.fragment),ge=a(),Ps=y("p"),Ps.textContent=Un,ke=a(),u(Ks.$$.fragment),Ce=a(),sl=y("p"),sl.textContent=wn,$e=a(),u(ll.$$.fragment),ze=a(),Ml=y("p"),this.h()},l(s){const l=Vn("svelte-u9bgzb",document.head);i=T(l,"META",{name:!0,content:!0}),l.forEach(e),m=t(s),p=T(s,"P",{}),Qn(p).forEach(e),U=t(s),J(k.$$.fragment,s),g=t(s),J(z.$$.fragment,s),C=t(s),J(I.$$.fragment,s),$=t(s),f.l(s),r=t(s),h=T(s,"P",{"data-svelte-h":!0}),d(h)!=="svelte-8rg866"&&(h.innerHTML=Ve),ul=t(s),J(V.$$.fragment,s),Jl=t(s),G=T(s,"P",{"data-svelte-h":!0}),d(G)!=="svelte-1nrltkq"&&(G.innerHTML=Ge),ol=t(s),R=T(s,"TABLE",{"data-svelte-h":!0}),d(R)!=="svelte-abdajt"&&(R.innerHTML=Re),jl=t(s),J(E.$$.fragment,s),ml=t(s),J(H.$$.fragment,s),yl=t(s),J(X.$$.fragment,s),Tl=t(s),D=T(s,"P",{"data-svelte-h":!0}),d(D)!=="svelte-2l0va5"&&(D.innerHTML=He),dl=t(s),_=T(s,"P",{"data-svelte-h":!0}),d(_)!=="svelte-1pkab8t"&&(_.innerHTML=Xe),Ul=t(s),Y=T(s,"P",{"data-svelte-h":!0}),d(Y)!=="svelte-1t7zxyh"&&(Y.textContent=De),wl=t(s),J(F.$$.fragment,s),bl=t(s),L=T(s,"P",{"data-svelte-h":!0}),d(L)!=="svelte-ikrrxj"&&(L.innerHTML=_e),hl=t(s),J(O.$$.fragment,s),xl=t(s),q=T(s,"P",{"data-svelte-h":!0}),d(q)!=="svelte-xwn6gy"&&(q.innerHTML=Ye),Il=t(s),J(P.$$.fragment,s),fl=t(s),J(K.$$.fragment,s),gl=t(s),ss=T(s,"P",{"data-svelte-h":!0}),d(ss)!=="svelte-kwefih"&&(ss.innerHTML=Fe),kl=t(s),J(ls.$$.fragment,s),Cl=t(s),J(es.$$.fragment,s),$l=t(s),ns=T(s,"P",{"data-svelte-h":!0}),d(ns)!=="svelte-14wtt33"&&(ns.textContent=Le),zl=t(s),J(as.$$.fragment,s),Bl=t(s),J(ts.$$.fragment,s),Ql=t(s),ps=T(s,"P",{"data-svelte-h":!0}),d(ps)!=="svelte-1n63hf7"&&(ps.innerHTML=Oe),Zl=t(s),J(is.$$.fragment,s),Al=t(s),J(rs.$$.fragment,s),Sl=t(s),J(cs.$$.fragment,s),Nl=t(s),Ms=T(s,"P",{"data-svelte-h":!0}),d(Ms)!=="svelte-162s1ta"&&(Ms.innerHTML=qe),El=t(s),J(W.$$.fragment,s),Wl=t(s),J(us.$$.fragment,s),vl=t(s),Js=T(s,"P",{"data-svelte-h":!0}),d(Js)!=="svelte-ou4i8v"&&(Js.innerHTML=Pe),Vl=t(s),Q.l(s),pl=t(s),J(os.$$.fragment,s),Gl=t(s),js=T(s,"P",{"data-svelte-h":!0}),d(js)!=="svelte-1il1qfv"&&(js.innerHTML=Ke),Rl=t(s),J(ms.$$.fragment,s),Hl=t(s),J(ys.$$.fragment,s),Xl=t(s),Ts=T(s,"P",{"data-svelte-h":!0}),d(Ts)!=="svelte-e9zjj8"&&(Ts.textContent=sn),Dl=t(s),J(ds.$$.fragment,s),_l=t(s),J(Us.$$.fragment,s),Yl=t(s),ws=T(s,"P",{"data-svelte-h":!0}),d(ws)!=="svelte-1y4icev"&&(ws.innerHTML=ln),Fl=t(s),bs=T(s,"UL",{"data-svelte-h":!0}),d(bs)!=="svelte-101w73y"&&(bs.innerHTML=en),Ll=t(s),hs=T(s,"P",{"data-svelte-h":!0}),d(hs)!=="svelte-1po40j3"&&(hs.innerHTML=nn),Ol=t(s),J(xs.$$.fragment,s),ql=t(s),A.l(s),il=t(s),Is=T(s,"P",{"data-svelte-h":!0}),d(Is)!=="svelte-1jjvzlr"&&(Is.textContent=an),Pl=t(s),N.l(s),rl=t(s),J(fs.$$.fragment,s),Kl=t(s),gs=T(s,"P",{"data-svelte-h":!0}),d(gs)!=="svelte-buv0zd"&&(gs.innerHTML=tn),se=t(s),J(ks.$$.fragment,s),le=t(s),J(Cs.$$.fragment,s),ee=t(s),$s=T(s,"P",{"data-svelte-h":!0}),d($s)!=="svelte-14c0e2l"&&($s.innerHTML=pn),ne=t(s),zs=T(s,"P",{"data-svelte-h":!0}),d(zs)!=="svelte-19dgt1c"&&(zs.innerHTML=rn),ae=t(s),v=T(s,"DIV",{class:!0,"data-svelte-h":!0}),d(v)!=="svelte-qf2tof"&&(v.innerHTML=cn),te=t(s),Bs=T(s,"P",{"data-svelte-h":!0}),d(Bs)!=="svelte-1hl7uvg"&&(Bs.innerHTML=Mn),pe=t(s),J(Qs.$$.fragment,s),ie=t(s),J(Zs.$$.fragment,s),re=t(s),As=T(s,"P",{"data-svelte-h":!0}),d(As)!=="svelte-161dpss"&&(As.innerHTML=un),ce=t(s),J(Ss.$$.fragment,s),Me=t(s),J(Ns.$$.fragment,s),ue=t(s),Es=T(s,"P",{"data-svelte-h":!0}),d(Es)!=="svelte-d6hya3"&&(Es.innerHTML=Jn),Je=t(s),J(Ws.$$.fragment,s),oe=t(s),vs=T(s,"P",{"data-svelte-h":!0}),d(vs)!=="svelte-11u2lrs"&&(vs.innerHTML=on),je=t(s),J(Vs.$$.fragment,s),me=t(s),Gs=T(s,"P",{"data-svelte-h":!0}),d(Gs)!=="svelte-19h3phn"&&(Gs.textContent=jn),ye=t(s),J(Rs.$$.fragment,s),Te=t(s),J(Hs.$$.fragment,s),de=t(s),Xs=T(s,"P",{"data-svelte-h":!0}),d(Xs)!=="svelte-1c61k0i"&&(Xs.textContent=mn),Ue=t(s),J(Ds.$$.fragment,s),we=t(s),_s=T(s,"P",{"data-svelte-h":!0}),d(_s)!=="svelte-28ykn1"&&(_s.innerHTML=yn),be=t(s),Ys=T(s,"P",{"data-svelte-h":!0}),d(Ys)!=="svelte-f7mp48"&&(Ys.innerHTML=Tn),he=t(s),J(Fs.$$.fragment,s),xe=t(s),J(Ls.$$.fragment,s),Ie=t(s),Os=T(s,"P",{"data-svelte-h":!0}),d(Os)!=="svelte-jzfa8h"&&(Os.innerHTML=dn),fe=t(s),J(qs.$$.fragment,s),ge=t(s),Ps=T(s,"P",{"data-svelte-h":!0}),d(Ps)!=="svelte-1qh60rk"&&(Ps.textContent=Un),ke=t(s),J(Ks.$$.fragment,s),Ce=t(s),sl=T(s,"P",{"data-svelte-h":!0}),d(sl)!=="svelte-5h0r78"&&(sl.textContent=wn),$e=t(s),J(ll.$$.fragment,s),ze=t(s),Ml=T(s,"P",{}),Qn(Ml).forEach(e),this.h()},h(){ve(i,"name","hf:doc:metadata"),ve(i,"content",ea),ve(v,"class","flex justify-center")},m(s,l){Gn(document.head,i),n(s,m,l),n(s,p,l),n(s,U,l),o(k,s,l),n(s,g,l),o(z,s,l),n(s,C,l),o(I,s,l),n(s,$,l),el[b].m(s,l),n(s,r,l),n(s,h,l),n(s,ul,l),o(V,s,l),n(s,Jl,l),n(s,G,l),n(s,ol,l),n(s,R,l),n(s,jl,l),o(E,s,l),n(s,ml,l),o(H,s,l),n(s,yl,l),o(X,s,l),n(s,Tl,l),n(s,D,l),n(s,dl,l),n(s,_,l),n(s,Ul,l),n(s,Y,l),n(s,wl,l),o(F,s,l),n(s,bl,l),n(s,L,l),n(s,hl,l),o(O,s,l),n(s,xl,l),n(s,q,l),n(s,Il,l),o(P,s,l),n(s,fl,l),o(K,s,l),n(s,gl,l),n(s,ss,l),n(s,kl,l),o(ls,s,l),n(s,Cl,l),o(es,s,l),n(s,$l,l),n(s,ns,l),n(s,zl,l),o(as,s,l),n(s,Bl,l),o(ts,s,l),n(s,Ql,l),n(s,ps,l),n(s,Zl,l),o(is,s,l),n(s,Al,l),o(rs,s,l),n(s,Sl,l),o(cs,s,l),n(s,Nl,l),n(s,Ms,l),n(s,El,l),o(W,s,l),n(s,Wl,l),o(us,s,l),n(s,vl,l),n(s,Js,l),n(s,Vl,l),nl[B].m(s,l),n(s,pl,l),o(os,s,l),n(s,Gl,l),n(s,js,l),n(s,Rl,l),o(ms,s,l),n(s,Hl,l),o(ys,s,l),n(s,Xl,l),n(s,Ts,l),n(s,Dl,l),o(ds,s,l),n(s,_l,l),o(Us,s,l),n(s,Yl,l),n(s,ws,l),n(s,Fl,l),n(s,bs,l),n(s,Ll,l),n(s,hs,l),n(s,Ol,l),o(xs,s,l),n(s,ql,l),al[Z].m(s,l),n(s,il,l),n(s,Is,l),n(s,Pl,l),tl[S].m(s,l),n(s,rl,l),o(fs,s,l),n(s,Kl,l),n(s,gs,l),n(s,se,l),o(ks,s,l),n(s,le,l),o(Cs,s,l),n(s,ee,l),n(s,$s,l),n(s,ne,l),n(s,zs,l),n(s,ae,l),n(s,v,l),n(s,te,l),n(s,Bs,l),n(s,pe,l),o(Qs,s,l),n(s,ie,l),o(Zs,s,l),n(s,re,l),n(s,As,l),n(s,ce,l),o(Ss,s,l),n(s,Me,l),o(Ns,s,l),n(s,ue,l),n(s,Es,l),n(s,Je,l),o(Ws,s,l),n(s,oe,l),n(s,vs,l),n(s,je,l),o(Vs,s,l),n(s,me,l),n(s,Gs,l),n(s,ye,l),o(Rs,s,l),n(s,Te,l),o(Hs,s,l),n(s,de,l),n(s,Xs,l),n(s,Ue,l),o(Ds,s,l),n(s,we,l),n(s,_s,l),n(s,be,l),n(s,Ys,l),n(s,he,l),o(Fs,s,l),n(s,xe,l),o(Ls,s,l),n(s,Ie,l),n(s,Os,l),n(s,fe,l),o(qs,s,l),n(s,ge,l),n(s,Ps,l),n(s,ke,l),o(Ks,s,l),n(s,Ce,l),n(s,sl,l),n(s,$e,l),o(ll,s,l),n(s,ze,l),n(s,Ml,l),Be=!0},p(s,[l]){const $n={};l&1&&($n.fw=s[0]),k.$set($n);let Se=b;b=hn(s),b!==Se&&(Ze(),c(el[Se],1,1,()=>{el[Se]=null}),Qe(),f=el[b],f||(f=el[b]=bn[b](s),f.c()),M(f,1),f.m(r.parentNode,r));const zn={};l&2&&(zn.$$scope={dirty:l,ctx:s}),E.$set(zn);const Bn={};l&2&&(Bn.$$scope={dirty:l,ctx:s}),W.$set(Bn);let Ne=B;B=In(s),B!==Ne&&(Ze(),c(nl[Ne],1,1,()=>{nl[Ne]=null}),Qe(),Q=nl[B],Q||(Q=nl[B]=xn[B](s),Q.c()),M(Q,1),Q.m(pl.parentNode,pl));let Ee=Z;Z=gn(s),Z!==Ee&&(Ze(),c(al[Ee],1,1,()=>{al[Ee]=null}),Qe(),A=al[Z],A||(A=al[Z]=fn[Z](s),A.c()),M(A,1),A.m(il.parentNode,il));let We=S;S=Cn(s),S!==We&&(Ze(),c(tl[We],1,1,()=>{tl[We]=null}),Qe(),N=tl[S],N||(N=tl[S]=kn[S](s),N.c()),M(N,1),N.m(rl.parentNode,rl))},i(s){Be||(M(k.$$.fragment,s),M(z.$$.fragment,s),M(I.$$.fragment,s),M(f),M(V.$$.fragment,s),M(E.$$.fragment,s),M(H.$$.fragment,s),M(X.$$.fragment,s),M(F.$$.fragment,s),M(O.$$.fragment,s),M(P.$$.fragment,s),M(K.$$.fragment,s),M(ls.$$.fragment,s),M(es.$$.fragment,s),M(as.$$.fragment,s),M(ts.$$.fragment,s),M(is.$$.fragment,s),M(rs.$$.fragment,s),M(cs.$$.fragment,s),M(W.$$.fragment,s),M(us.$$.fragment,s),M(Q),M(os.$$.fragment,s),M(ms.$$.fragment,s),M(ys.$$.fragment,s),M(ds.$$.fragment,s),M(Us.$$.fragment,s),M(xs.$$.fragment,s),M(A),M(N),M(fs.$$.fragment,s),M(ks.$$.fragment,s),M(Cs.$$.fragment,s),M(Qs.$$.fragment,s),M(Zs.$$.fragment,s),M(Ss.$$.fragment,s),M(Ns.$$.fragment,s),M(Ws.$$.fragment,s),M(Vs.$$.fragment,s),M(Rs.$$.fragment,s),M(Hs.$$.fragment,s),M(Ds.$$.fragment,s),M(Fs.$$.fragment,s),M(Ls.$$.fragment,s),M(qs.$$.fragment,s),M(Ks.$$.fragment,s),M(ll.$$.fragment,s),Be=!0)},o(s){c(k.$$.fragment,s),c(z.$$.fragment,s),c(I.$$.fragment,s),c(f),c(V.$$.fragment,s),c(E.$$.fragment,s),c(H.$$.fragment,s),c(X.$$.fragment,s),c(F.$$.fragment,s),c(O.$$.fragment,s),c(P.$$.fragment,s),c(K.$$.fragment,s),c(ls.$$.fragment,s),c(es.$$.fragment,s),c(as.$$.fragment,s),c(ts.$$.fragment,s),c(is.$$.fragment,s),c(rs.$$.fragment,s),c(cs.$$.fragment,s),c(W.$$.fragment,s),c(us.$$.fragment,s),c(Q),c(os.$$.fragment,s),c(ms.$$.fragment,s),c(ys.$$.fragment,s),c(ds.$$.fragment,s),c(Us.$$.fragment,s),c(xs.$$.fragment,s),c(A),c(N),c(fs.$$.fragment,s),c(ks.$$.fragment,s),c(Cs.$$.fragment,s),c(Qs.$$.fragment,s),c(Zs.$$.fragment,s),c(Ss.$$.fragment,s),c(Ns.$$.fragment,s),c(Ws.$$.fragment,s),c(Vs.$$.fragment,s),c(Rs.$$.fragment,s),c(Hs.$$.fragment,s),c(Ds.$$.fragment,s),c(Fs.$$.fragment,s),c(Ls.$$.fragment,s),c(qs.$$.fragment,s),c(Ks.$$.fragment,s),c(ll.$$.fragment,s),Be=!1},d(s){s&&(e(m),e(p),e(U),e(g),e(C),e($),e(r),e(h),e(ul),e(Jl),e(G),e(ol),e(R),e(jl),e(ml),e(yl),e(Tl),e(D),e(dl),e(_),e(Ul),e(Y),e(wl),e(bl),e(L),e(hl),e(xl),e(q),e(Il),e(fl),e(gl),e(ss),e(kl),e(Cl),e($l),e(ns),e(zl),e(Bl),e(Ql),e(ps),e(Zl),e(Al),e(Sl),e(Nl),e(Ms),e(El),e(Wl),e(vl),e(Js),e(Vl),e(pl),e(Gl),e(js),e(Rl),e(Hl),e(Xl),e(Ts),e(Dl),e(_l),e(Yl),e(ws),e(Fl),e(bs),e(Ll),e(hs),e(Ol),e(ql),e(il),e(Is),e(Pl),e(rl),e(Kl),e(gs),e(se),e(le),e(ee),e($s),e(ne),e(zs),e(ae),e(v),e(te),e(Bs),e(pe),e(ie),e(re),e(As),e(ce),e(Me),e(ue),e(Es),e(Je),e(oe),e(vs),e(je),e(me),e(Gs),e(ye),e(Te),e(de),e(Xs),e(Ue),e(we),e(_s),e(be),e(Ys),e(he),e(xe),e(Ie),e(Os),e(fe),e(ge),e(Ps),e(ke),e(Ce),e(sl),e($e),e(ze),e(Ml)),e(i),j(k,s),j(z,s),j(I,s),el[b].d(s),j(V,s),j(E,s),j(H,s),j(X,s),j(F,s),j(O,s),j(P,s),j(K,s),j(ls,s),j(es,s),j(as,s),j(ts,s),j(is,s),j(rs,s),j(cs,s),j(W,s),j(us,s),nl[B].d(s),j(os,s),j(ms,s),j(ys,s),j(ds,s),j(Us,s),j(xs,s),al[Z].d(s),tl[S].d(s),j(fs,s),j(ks,s),j(Cs,s),j(Qs,s),j(Zs,s),j(Ss,s),j(Ns,s),j(Ws,s),j(Vs,s),j(Rs,s),j(Hs,s),j(Ds,s),j(Fs,s),j(Ls,s),j(qs,s),j(Ks,s),j(ll,s)}}}const ea='{"title":"Superputerile tokenizerilor rapizi","local":"fast-tokenizers-special-powers","sections":[{"title":"Batch encoding","local":"batch-encoding","sections":[],"depth":2},{"title":"În interiorul pipelineului token-classification","local":"inside-the-token-classification-pipeline","sections":[{"title":"Obținerea rezultatelor de bază cu pipelineul","local":"getting-the-base-results-with-the-pipeline","sections":[],"depth":3},{"title":"De la inputuri la predicții","local":"from-inputs-to-predictions","sections":[],"depth":3},{"title":"Gruparea entităților","local":"grouping-entities","sections":[],"depth":3}],"depth":2}],"depth":1}';function na(x,i,m){let p="pt";return En(()=>{const U=new URLSearchParams(window.location.search);m(0,p=U.get("fw")||"pt")}),[p]}class Ja extends Wn{constructor(i){super(),vn(this,i,na,la,Nn,{})}}export{Ja as component};
