import{s as Rs,o as Ws}from"../chunks/scheduler.37c15a92.js";import{S as Ls,i as Bs,g as f,s as p,r as T,A as Fs,h as y,f as n,c,j as Es,u as h,x as b,k as yt,y as Ps,a,v as J,t as m,b as B,d as M,w as U,m as Vs,n as Zs,p as F}from"../chunks/index.2bf4358c.js";import{T as Gs}from"../chunks/Tip.363c041f.js";import{Y as Ss}from"../chunks/Youtube.1e50a667.js";import{C as w}from"../chunks/CodeBlock.4f5fc1ad.js";import{D as Hs}from"../chunks/DocNotebookDropdown.d9dfeb24.js";import{F as Xs}from"../chunks/FrameworkSwitchCourse.8d4d4ab6.js";import{H as dl}from"../chunks/Heading.8ada512a.js";function qs(d){let t,i;return t=new Hs({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/it/chapter2/section2_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/it/chapter2/section2_tf.ipynb"}]}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function Ys(d){let t,i;return t=new Hs({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/it/chapter2/section2_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/it/chapter2/section2_pt.ipynb"}]}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function Ks(d){let t;return{c(){t=Vs("Questa è la prima sezione in cui il contenuto è leggermente diverso a seconda che si utilizzi PyTorch o TensorFlow. Attivate lo switch sopra il titolo per selezionare la tua piattaforma preferita!")},l(i){t=Zs(i,"Questa è la prima sezione in cui il contenuto è leggermente diverso a seconda che si utilizzi PyTorch o TensorFlow. Attivate lo switch sopra il titolo per selezionare la tua piattaforma preferita!")},m(i,l){a(i,t,l)},d(i){i&&n(t)}}}function Os(d){let t,i;return t=new Ss({props:{id:"wVN12smEvqg"}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function en(d){let t,i;return t=new Ss({props:{id:"1pedAIvTWXk"}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function ln(d){let t,i;return t=new w({props:{code:"cmF3X2lucHV0cyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElNUQlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocmF3X2lucHV0cyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQXByaW50KGlucHV0cyk=",highlighted:`raw_inputs = [
    <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
    <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
]
inputs = tokenizer(raw_inputs, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-built_in">print</span>(inputs)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function tn(d){let t,i;return t=new w({props:{code:"cmF3X2lucHV0cyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElNUQlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocmF3X2lucHV0cyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXByaW50KGlucHV0cyk=",highlighted:`raw_inputs = [
    <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
    <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
]
inputs = tokenizer(raw_inputs, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(inputs)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function sn(d){let t,i="Ecco come appaiono i risultati come tensori TensorFlow:",l,r,u;return r=new w({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJ2lucHV0X2lkcyclM0ElMjAlM0N0Zi5UZW5zb3IlM0ElMjBzaGFwZSUzRCgyJTJDJTIwMTYpJTJDJTIwZHR5cGUlM0RpbnQzMiUyQyUyMG51bXB5JTNEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJyYXkoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwJTIwMTAxJTJDJTIwJTIwMTA0NSUyQyUyMCUyMDEwMDUlMkMlMjAlMjAyMzEwJTJDJTIwJTIwMjA0MiUyQyUyMCUyMDM0MDMlMkMlMjAlMjAyMDA1JTJDJTIwJTIwMTAzNyUyQyUyMDE3NjYyJTJDJTIwMTIxNzIlMkMlMjAlMjAyNjA3JTJDJTIwJTIwMjAyNiUyQyUyMCUyMDI4NzglMkMlMjAlMjAyMTY2JTJDJTIwJTIwMTAxMiUyQyUyMCUyMCUyMDEwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QiUyMCUyMDEwMSUyQyUyMCUyMDEwNDUlMkMlMjAlMjA1MjIzJTJDJTIwJTIwMjAyMyUyQyUyMCUyMDIwNjElMkMlMjAlMjAyMTcyJTJDJTIwJTIwJTIwOTk5JTJDJTIwJTIwJTIwMTAyJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMjBkdHlwZSUzRGludDMyKSUzRSUyQyUyMCUwQSUyMCUyMCUyMCUyMCdhdHRlbnRpb25fbWFzayclM0ElMjAlM0N0Zi5UZW5zb3IlM0ElMjBzaGFwZSUzRCgyJTJDJTIwMTYpJTJDJTIwZHR5cGUlM0RpbnQzMiUyQyUyMG51bXB5JTNEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJyYXkoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QjElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMjBkdHlwZSUzRGludDMyKSUzRSUwQSU3RA==",highlighted:`{
    <span class="hljs-string">&#x27;input_ids&#x27;</span>: &lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>), dtype=int32, numpy=
        array([
            [  <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">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">5223</span>,  <span class="hljs-number">2023</span>,  <span class="hljs-number">2061</span>,  <span class="hljs-number">2172</span>,   <span class="hljs-number">999</span>,   <span class="hljs-number">102</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">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>]
        ], dtype=int32)&gt;, 
    <span class="hljs-string">&#x27;attention_mask&#x27;</span>: &lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>), dtype=int32, numpy=
        array([
            [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
            [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</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">0</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>]
        ], dtype=int32)&gt;
}`,wrap:!1}}),{c(){t=f("p"),t.textContent=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-rb7hpw"&&(t.textContent=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function nn(d){let t,i="Ecco come appaiono i risultati come tensori PyTorch:",l,r,u;return r=new w({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJ2lucHV0X2lkcyclM0ElMjB0ZW5zb3IoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwJTIwMTAxJTJDJTIwJTIwMTA0NSUyQyUyMCUyMDEwMDUlMkMlMjAlMjAyMzEwJTJDJTIwJTIwMjA0MiUyQyUyMCUyMDM0MDMlMkMlMjAlMjAyMDA1JTJDJTIwJTIwMTAzNyUyQyUyMDE3NjYyJTJDJTIwMTIxNzIlMkMlMjAyNjA3JTJDJTIwJTIwMjAyNiUyQyUyMCUyMDI4NzglMkMlMjAlMjAyMTY2JTJDJTIwJTIwMTAxMiUyQyUyMCUyMCUyMDEwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QiUyMCUyMDEwMSUyQyUyMCUyMDEwNDUlMkMlMjAlMjA1MjIzJTJDJTIwJTIwMjAyMyUyQyUyMCUyMDIwNjElMkMlMjAlMjAyMTcyJTJDJTIwJTIwJTIwOTk5JTJDJTIwJTIwJTIwMTAyJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlNUQlMEElMjAlMjAlMjAlMjAlNUQpJTJDJTIwJTBBJTIwJTIwJTIwJTIwJ2F0dGVudGlvbl9tYXNrJyUzQSUyMHRlbnNvciglNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCU1RCUwQSUyMCUyMCUyMCUyMCU1RCklMEElN0Q=",highlighted:`{
    <span class="hljs-string">&#x27;input_ids&#x27;</span>: tensor([
        [  <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">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">5223</span>,  <span class="hljs-number">2023</span>,  <span class="hljs-number">2061</span>,  <span class="hljs-number">2172</span>,   <span class="hljs-number">999</span>,   <span class="hljs-number">102</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">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>]
    ]), 
    <span class="hljs-string">&#x27;attention_mask&#x27;</span>: tensor([
        [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
        [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</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">0</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>]
    ])
}`,wrap:!1}}),{c(){t=f("p"),t.textContent=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-1e7hvq4"&&(t.textContent=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function an(d){let t,i="Possiamo scaricare il nostro modello preaddestrato nello stesso modo in cui abbiamo fatto con il nostro tokenizer.  🤗 Transformers fornisce una classe <code>TFAutoModel</code> che ha anche un metodo <code>from_pretrained</code>:",l,r,u;return r=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsJTBBJTBBY2hlY2twb2ludCUyMCUzRCUyMCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkLWZpbmV0dW5lZC1zc3QtMi1lbmdsaXNoJTIyJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = TFAutoModel.from_pretrained(checkpoint)`,wrap:!1}}),{c(){t=f("p"),t.innerHTML=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-168vw5"&&(t.innerHTML=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function on(d){let t,i="Possiamo scaricare il nostro modello preaddestrato nello stesso modo in cui abbiamo fatto con il nostro tokenizer. 🤗 Transformers fornisce una classe <code>AutoModel</code> che ha anche un metodo <code>from_pretrained()</code>:",l,r,u;return r=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMiUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = AutoModel.from_pretrained(checkpoint)`,wrap:!1}}),{c(){t=f("p"),t.innerHTML=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-19bwkio"&&(t.innerHTML=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function rn(d){let t,i,l,r;return t=new w({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFwcmludChvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlLnNoYXBlKQ==",highlighted:`outputs = model(inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),l=new w({props:{code:"KDIlMkMlMjAxNiUyQyUyMDc2OCk=",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>)',wrap:!1}}),{c(){T(t.$$.fragment),i=p(),T(l.$$.fragment)},l(u){h(t.$$.fragment,u),i=c(u),h(l.$$.fragment,u)},m(u,o){J(t,u,o),a(u,i,o),J(l,u,o),r=!0},i(u){r||(M(t.$$.fragment,u),M(l.$$.fragment,u),r=!0)},o(u){m(t.$$.fragment,u),m(l.$$.fragment,u),r=!1},d(u){u&&n(i),U(t,u),U(l,u)}}}function pn(d){let t,i,l,r;return t=new w({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQXByaW50KG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUuc2hhcGUp",highlighted:`outputs = model(**inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),l=new w({props:{code:"dG9yY2guU2l6ZSglNUIyJTJDJTIwMTYlMkMlMjA3NjglNUQp",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>])',wrap:!1}}),{c(){T(t.$$.fragment),i=p(),T(l.$$.fragment)},l(u){h(t.$$.fragment,u),i=c(u),h(l.$$.fragment,u)},m(u,o){J(t,u,o),a(u,i,o),J(l,u,o),r=!0},i(u){r||(M(t.$$.fragment,u),M(l.$$.fragment,u),r=!0)},o(u){m(t.$$.fragment,u),m(l.$$.fragment,u),r=!1},d(u){u&&n(i),U(t,u),U(l,u)}}}function cn(d){let t,i="Per il nostro esempio, avremo bisogno di un modello con una classificazion head della sequenza (per poter classificare le frasi come positive o negative). Quindi, non useremo la classe <code>TFAutoModel</code>, ma <code>TFAutoModelForSequenceClassification</code>:",l,r,u;return r=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMiUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dHMp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = TFAutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(inputs)`,wrap:!1}}),{c(){t=f("p"),t.innerHTML=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-1jd8c81"&&(t.innerHTML=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function un(d){let t,i="Per il nostro esempio, avremo bisogno di un modello con una classificazion head della sequenza (per poter classificare le frasi come positive o negative). Quindi, non useremo la classe <code>AutoModel</code>, ma <code>AutoModelForSequenceClassification</code>:",l,r,u;return r=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(**inputs)`,wrap:!1}}),{c(){t=f("p"),t.innerHTML=i,l=p(),T(r.$$.fragment)},l(o){t=y(o,"P",{"data-svelte-h":!0}),b(t)!=="svelte-btrap5"&&(t.innerHTML=i),l=c(o),h(r.$$.fragment,o)},m(o,j){a(o,t,j),a(o,l,j),J(r,o,j),u=!0},i(o){u||(M(r.$$.fragment,o),u=!0)},o(o){m(r.$$.fragment,o),u=!1},d(o){o&&(n(t),n(l)),U(r,o)}}}function mn(d){let t,i;return t=new w({props:{code:"KDIlMkMlMjAyKQ==",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)',wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function Mn(d){let t,i;return t=new w({props:{code:"dG9yY2guU2l6ZSglNUIyJTJDJTIwMiU1RCk=",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">2</span>])',wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function dn(d){let t,i;return t=new w({props:{code:"JTNDdGYuVGVuc29yJTNBJTIwc2hhcGUlM0QoMiUyQyUyMDIpJTJDJTIwZHR5cGUlM0RmbG9hdDMyJTJDJTIwbnVtcHklM0QlMEElMjAlMjAlMjAlMjBhcnJheSglNUIlNUItMS41NjA2OTkxJTJDJTIwJTIwMS42MTIyODQyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwNC4xNjkyMzElMjAlMkMlMjAtMy4zNDY0NDcyJTVEJTVEJTJDJTIwZHR5cGUlM0RmbG9hdDMyKSUzRQ==",highlighted:`&lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>), dtype=float32, numpy=
    array([[-<span class="hljs-number">1.5606991</span>,  <span class="hljs-number">1.6122842</span>],
           [ <span class="hljs-number">4.169231</span> , -<span class="hljs-number">3.3464472</span>]], dtype=float32)&gt;`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function fn(d){let t,i;return t=new w({props:{code:"dGVuc29yKCU1QiU1Qi0xLjU2MDclMkMlMjAlMjAxLjYxMjMlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlMjA0LjE2OTIlMkMlMjAtMy4zNDY0JTVEJTVEJTJDJTIwZ3JhZF9mbiUzRCUzQ0FkZG1tQmFja3dhcmQlM0Up",highlighted:`tensor([[-<span class="hljs-number">1.5607</span>,  <span class="hljs-number">1.6123</span>],
        [ <span class="hljs-number">4.1692</span>, -<span class="hljs-number">3.3464</span>]], grad_fn=&lt;AddmmBackward&gt;)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function yn(d){let t,i;return t=new w({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFwcmVkaWN0aW9ucyUyMCUzRCUyMHRmLm1hdGguc29mdG1heChvdXRwdXRzLmxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklMEFwcmludChwcmVkaWN0aW9ucyk=",highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

predictions = tf.math.softmax(outputs.logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function bn(d){let t,i;return t=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFwcmVkaWN0aW9ucyUyMCUzRCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwuc29mdG1heChvdXRwdXRzLmxvZ2l0cyUyQyUyMGRpbSUzRC0xKSUwQXByaW50KHByZWRpY3Rpb25zKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

predictions = torch.nn.functional.softmax(outputs.logits, dim=-<span class="hljs-number">1</span>)
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function Tn(d){let t,i;return t=new w({props:{code:"dGYuVGVuc29yKCUwQSU1QiU1QjQuMDE5NTE2NzFlLTAyJTIwOS41OTgwNDgzM2UtMDElNUQlMEElMjAlNUI5Ljk5NDU1ODdlLTAxJTIwNS40NDE4NDI0ZS0wNCU1RCU1RCUyQyUyMHNoYXBlJTNEKDIlMkMlMjAyKSUyQyUyMGR0eXBlJTNEZmxvYXQzMik=",highlighted:`tf.Tensor(
[[<span class="hljs-number">4.01951671e-02</span> <span class="hljs-number">9.59804833e-01</span>]
 [<span class="hljs-number">9.9945587e-01</span> <span class="hljs-number">5.4418424e-04</span>]], shape=(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>), dtype=float32)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function hn(d){let t,i;return t=new w({props:{code:"dGVuc29yKCU1QiU1QjQuMDE5NWUtMDIlMkMlMjA5LjU5ODBlLTAxJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCOS45OTQ2ZS0wMSUyQyUyMDUuNDQxOGUtMDQlNUQlNUQlMkMlMjBncmFkX2ZuJTNEJTNDU29mdG1heEJhY2t3YXJkJTNFKQ==",highlighted:`tensor([[<span class="hljs-number">4.0195e-02</span>, <span class="hljs-number">9.5980e-01</span>],
        [<span class="hljs-number">9.9946e-01</span>, <span class="hljs-number">5.4418e-04</span>]], grad_fn=&lt;SoftmaxBackward&gt;)`,wrap:!1}}),{c(){T(t.$$.fragment)},l(l){h(t.$$.fragment,l)},m(l,r){J(t,l,r),i=!0},i(l){i||(M(t.$$.fragment,l),i=!0)},o(l){m(t.$$.fragment,l),i=!1},d(l){U(t,l)}}}function Jn(d){let t;return{c(){t=Vs("✏️ **Provaci anche tu!** Scegli due (o più) testi di tua proprietà e lanciali all'interno della pipeline `sentiment-analysis`. Successivamente, replica i passi che hai visto qui e verifica di aver ottenuto gli stessi risultati!")},l(i){t=Zs(i,"✏️ **Provaci anche tu!** Scegli due (o più) testi di tua proprietà e lanciali all'interno della pipeline `sentiment-analysis`. Successivamente, replica i passi che hai visto qui e verifica di aver ottenuto gli stessi risultati!")},m(i,l){a(i,t,l)},d(i){i&&n(t)}}}function Un(d){let t,i,l,r,u,o,j,yl,_,$,sl,P,bl,C,k,nl,K,It='Cominciamo con un esempio completo, dando un’occhiata a ciò che è successo dietro le quinte quando abbiamo eseguito il seguente codice nel <a href="/course/chapter1">Capitolo 1</a>:',Tl,O,hl,ee,gt="e ottenuto:",Jl,le,Ul,te,vt='Come abbiamo visto nel <a href="/course/chapter1">Capitolo 1</a>, questa pipeline raggruppa tre fasi: la pre-elaborazione, il passaggio degli input attraverso il modello e la post-elaborazione:',jl,X,At='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline.svg" alt="La pipeline NLP completa: tokenizzazione del testo, conversione in ID e inferenza attraverso il modello Transformer ed il modello head."/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline-dark.svg" alt="La pipeline NLP completa: tokenizzazione del testo, conversione in ID e inferenza attraverso il modello Transformer ed il modello head.."/>',wl,se,xt="Esaminiamo rapidamente ciascuno di essi.",_l,ne,$l,ae,zt="Come altre reti neurali, i modelli Transformer non possono elaborare direttamente il testo non elaborato, quindi la prima fase della nostra pipeline consiste nel convertire gli input testuali in numeri che il modello possa interpretare. Per fare ciò, utilizziamo un <em>tokenizer</em>, che sarà responsabile di:",Cl,ie,Qt="<li>Suddivisione dell’input in parole, sottoparole o simboli (come la punteggiatura) che vengono chiamati <em>token</em>.</li> <li>Mappare ogni token in un numero intero</li> <li>Aggiunta di ulteriori input che possono essere utili per il modello</li>",kl,oe,Dt='Tutta questa preelaborazione deve essere fatta esattamente nello stesso modo in cui è stato preaddestrato il modello, quindi dobbiamo prima scaricare queste informazioni dal <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a>. Per farlo, si usa la classe <code>AutoTokenizer</code> e il suo metodo <code>from_pretrained()</code>. Utilizzando il nome del checkpoint del nostro modello, recupererà automaticamente i dati associati al tokenizer del modello e li metterà in cache (in modo che vengano scaricati solo la prima volta che si esegue il codice sottostante).',Il,re,Nt='Poiché il checkpoint predefinito della pipeline <code>sentiment-analysis</code> è <code>distilbert-base-uncased-finetuned-sst-2-english</code> (si può vedere la sua scheda modello <a href="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english" rel="nofollow">qui</a>), eseguiamo quanto segue:',gl,pe,vl,ce,Et="Una volta che abbiamo il tokenizer, possiamo passargli direttamente le nostre frasi e otterremo un dizionario pronto per il nostro modello! L’unica cosa che resta da fare è convertire l’elenco degli ID in ingresso in tensori.",Al,ue,Gt="È possibile utilizzare i 🤗 Transformer senza doversi preoccupare di quale framework ML venga utilizzato come backend;potrebbe essere PyTorch o TensorFlow, o Flax per alcuni modelli. Tuttavia, i modelli Transformer accettano solo <em>tensors</em> come input. Se è la prima volta che sentite parlare di tensori, potete pensare a loro come array NumPy. Un array NumPy può essere uno scalare (0D), un vettore (1D), una matrice (2D) o avere più dimensioni. Si tratta effettivamente di un tensore; i tensori di altri framework ML si comportano in modo simile e di solito sono semplici da istanziare come gli array NumPy.",xl,me,Vt="Per specificare il tipo di tensori che vogliamo ottenere (PyTorch, TensorFlow o NumPy), usiamo l’argomento <code>return_tensors</code>:",zl,I,g,al,Me,Zt="Non preoccupatevi ancora di padding e truncation; li spiegheremo più avanti.Le cose principali da ricordare sono che si può passare una frase o un elenco di frasi, oltre a specificare il tipo di tensori che si desidera ottenere (se non viene passato alcun tipo, si otterrà una lista di liste come risultato).",Ql,v,A,il,de,St="L’output stesso è un dizionario contenente due chiavi, <code>input_ids</code> e <code>attention_mask</code>. <code>input_ids</code> contiene due righe di interi (uno per ogni frase) che sono gli identificatori unici dei token in ogni frase. Spiegheremo cosa sia la <code>attention_mask</code> più avanti in questo capitolo.",Dl,fe,Nl,x,z,ol,ye,Ht="In questo frammento di codice, abbiamo scaricato lo stesso checkpoint usato in precedenza nella nostra pipeline (in realtà dovrebbe essere già nella cache) e abbiamo istanziato un modello con esso.",El,be,Rt="Questa architettura contiene solo il modulo Transformer di base: dati alcuni input, produce quelli che chiameremo <em>hidden states</em>, noti anche come <em>features</em>. Per ogni input del modello, recupereremo un vettore ad alta dimensionalità che rappresenta la <strong>comprensione contestuale di quell’input da parte del modello Transformer</strong>.",Gl,Te,Wt="Se per te tutto questo non ha senso, non preoccuparti. Ti spiegheremo tutto più avanti.",Vl,he,Lt='Anche se questi stati nascosti possono essere utili da soli, di solito sono input di un’altra parte del modello, nota come <em>head</em>. Nel <a href="/course/chapter1">Capitolo 1</a>, i diversi compiti potrebbero essere eseguiti con la stessa architettura, ma a ciascuno di essi sarà associata una head diversa.',Zl,Je,Sl,Ue,Bt="Il vettore emesso dal modulo Transformer è solitamente di grandi dimensioni. In genere ha tre dimensioni:",Hl,je,Ft="<li><strong>Dimensione del batch</strong>: Il numero di sequenze elaborate alla volta (2 nel nostro esempio).</li> <li><strong>Lunghezza della sequenza</strong>: La lunghezza della rappresentazione numerica della sequenza (16 nel nostro esempio).</li> <li><strong>Dimensione nascosta</strong>: La dimensione del vettore di ciascun ingresso del modello.</li>",Rl,we,Pt="Si dice che è “ad alta dimensionalità” a causa dell’ultimo valore. La dimensione nascosta può essere molto grande (768 è comune per i modelli più piccoli, mentre nei modelli più grandi può arrivare a 3072 o più).",Wl,_e,Xt="Lo possiamo vedere se alimentiamo il nostro modello con gli input che abbiamo preelaborato:",Ll,Q,D,rl,$e,qt="Si noti che gli output dei modelli 🤗 Transformers si comportano come <code>namedtuple</code> o dizionari. Si può accedere agli elementi per attributi (come abbiamo fatto noi) sia per chiave (<code>outputs[&quot;last_hidden_state&quot;]</code>), sia per indice se si sa esattamente dove si trova ciò che si sta cercando (<code>outputs[0]</code>).",Bl,Ce,Fl,ke,Yt="Le model head prendono in input il vettore ad alta dimensione degli stati nascosti e lo proiettano su una dimensione diversa. Di solito sono composte da uno o pochi strati lineari:",Pl,q,Kt='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head.svg" alt="Una rete di Transformer accanto alla sua head."/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head-dark.svg" alt="Una rete di Transformer accanto alla sua head."/>',Xl,Ie,Ot="Gli output del modello Transformer vengono inviati direttamente alla model head per essere elaborati.",ql,ge,es="In questo diagramma, il modello è rappresentato dallo strato embeddings e dagli strati successivi. Il livello embeddings converte ogni ID dell’input tokenizzato in un vettore che rappresenta il token associato. I livelli successivi manipolano questi vettori utilizzando il meccanismo di attenzione per produrre la rappresentazione finale delle frasi.",Yl,ve,ls="Esistono diverse architetture disponibili nei 🤗 Transformers, ognuna delle quali è stata progettata per affrontare un compito specifico. Ecco un elenco non esaustivo:",Kl,Ae,ts="<li><code>*Model</code> (retrieve the hidden states)</li> <li><code>*ForCausalLM</code></li> <li><code>*ForMaskedLM</code></li> <li><code>*ForMultipleChoice</code></li> <li><code>*ForQuestionAnswering</code></li> <li><code>*ForSequenceClassification</code></li> <li><code>*ForTokenClassification</code></li> <li>e altre 🤗</li>",Ol,N,E,pl,xe,ss="Ora, se osserviamo la forma dei nostri output, la dimensionalità sarà molto più bassa: la model head prende in input i vettori ad alta dimensionalità che abbiamo visto prima e produce vettori contenenti due valori (uno per etichetta):",et,ze,lt,G,V,cl,Qe,ns="Dato che abbiamo solo due frasi e due etichette, il risultato che otteniamo dal nostro modello è di forma 2 x 2.",tt,De,st,Ne,as="I valori che otteniamo come output dal nostro modello non hanno necessariamente senso da soli. Diamo un’occhiata:",nt,Ee,at,Z,S,ul,Ge,is='Il nostro modello ha previsto <code>[-1.5607, 1.6123]</code> per la prima frase e <code>[ 4.1692, -3.3464]</code> per la seconda. Non si tratta di probabilità ma di <em>logit</em>, i punteggi non normalizzati emessi dall’ultimo livello del modello. Per poterli convertire in probabilità, devono passare attraverso un layer <a href="https://en.wikipedia.org/wiki/Softmax_function" rel="nofollow">SoftMax</a> (tutti i modelli 🤗 Transformers producono i logits, poiché la funzione di perdita per l’addestramento generalmente fonde l’ultima funzione di attivazione, come SoftMax, con la funzione di perdita effettiva, come la cross entropy):',it,H,R,ml,W,L,Ml,Ve,os="Ora possiamo vedere che il modello ha previsto <code>[0,0402, 0,9598]</code> per la prima frase e <code>[0,9995, 0,0005]</code> per la seconda. Si tratta di punteggi di probabilità riconoscibili.",ot,Ze,rs="Per ottenere le etichette corrispondenti a ogni posizione, si può ispezionare l’attributo <code>id2label</code> della configurazione del modello (si veda la prossima sezione):",rt,Se,pt,He,ct,Re,ps="Ora possiamo concludere che il modello ha previsto quanto segue:",ut,We,cs="<li>Prima frase: NEGATIVE: 0.0402, POSITIVE: 0.9598</li> <li>Seconda frase: NEGATIVE: 0.9995, POSITIVE: 0.0005</li>",mt,Le,us="Abbiamo riprodotto con successo le tre fasi della pipeline: preelaborazione con i tokenizer, passaggio degli input attraverso il modello e postelaborazione! Ora prendiamoci un po’ di tempo per approfondire ognuna di queste fasi.",Mt,Y,dt,fl,ft;u=new Xs({props:{fw:d[0]}}),j=new dl({props:{title:"Dietro la pipeline",local:"dietro-la-pipeline",headingTag:"h1"}});const ms=[Ys,qs],Be=[];function Ms(e,s){return e[0]==="pt"?0:1}_=Ms(d),$=Be[_]=ms[_](d),P=new Gs({props:{$$slots:{default:[Ks]},$$scope:{ctx:d}}});const ds=[en,Os],Fe=[];function fs(e,s){return e[0]==="pt"?0:1}C=fs(d),k=Fe[C]=ds[C](d),O=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnNlbnRpbWVudC1hbmFseXNpcyUyMiklMEFjbGFzc2lmaWVyKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElMjAlMjAlMjAlMjAlNUQlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>)
classifier(
    [
        <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
        <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
    ]
)`,wrap:!1}}),le=new w({props:{code:"JTVCJTdCJ2xhYmVsJyUzQSUyMCdQT1NJVElWRSclMkMlMjAnc2NvcmUnJTNBJTIwMC45NTk4MDQ3MTM3MjYwNDM3JTdEJTJDJTBBJTIwJTdCJ2xhYmVsJyUzQSUyMCdORUdBVElWRSclMkMlMjAnc2NvcmUnJTNBJTIwMC45OTk0NTU4MDk1OTMyMDA3JTdEJTVE",highlighted:`[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9598047137260437</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;NEGATIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9994558095932007</span>}]`,wrap:!1}}),ne=new dl({props:{title:"Preelaborazione con un tokenizer",local:"preelaborazione-con-un-tokenizer",headingTag:"h2"}}),pe=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",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)`,wrap:!1}});const ys=[tn,ln],Pe=[];function bs(e,s){return e[0]==="pt"?0:1}I=bs(d),g=Pe[I]=ys[I](d);const Ts=[nn,sn],Xe=[];function hs(e,s){return e[0]==="pt"?0:1}v=hs(d),A=Xe[v]=Ts[v](d),fe=new dl({props:{title:"Passare attraverso il modello",local:"passare-attraverso-il-modello",headingTag:"h2"}});const Js=[on,an],qe=[];function Us(e,s){return e[0]==="pt"?0:1}x=Us(d),z=qe[x]=Js[x](d),Je=new dl({props:{title:"Un vettore ad alta dimensionalità?",local:"un-vettore-ad-alta-dimensionalità",headingTag:"h3"}});const js=[pn,rn],Ye=[];function ws(e,s){return e[0]==="pt"?0:1}Q=ws(d),D=Ye[Q]=js[Q](d),Ce=new dl({props:{title:"Model heads: Dare un senso ai numeri",local:"model-heads-dare-un-senso-ai-numeri",headingTag:"h3"}});const _s=[un,cn],Ke=[];function $s(e,s){return e[0]==="pt"?0:1}N=$s(d),E=Ke[N]=_s[N](d),ze=new w({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMuc2hhcGUp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)',wrap:!1}});const Cs=[Mn,mn],Oe=[];function ks(e,s){return e[0]==="pt"?0:1}G=ks(d),V=Oe[G]=Cs[G](d),De=new dl({props:{title:"Postprocessing the output",local:"postprocessing-the-output",headingTag:"h2"}}),Ee=new w({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)',wrap:!1}});const Is=[fn,dn],el=[];function gs(e,s){return e[0]==="pt"?0:1}Z=gs(d),S=el[Z]=Is[Z](d);const vs=[bn,yn],ll=[];function As(e,s){return e[0]==="pt"?0:1}H=As(d),R=ll[H]=vs[H](d);const xs=[hn,Tn],tl=[];function zs(e,s){return e[0]==="pt"?0:1}return W=zs(d),L=tl[W]=xs[W](d),Se=new w({props:{code:"bW9kZWwuY29uZmlnLmlkMmxhYmVs",highlighted:"model.config.id2label",wrap:!1}}),He=new w({props:{code:"JTdCMCUzQSUyMCdORUdBVElWRSclMkMlMjAxJTNBJTIwJ1BPU0lUSVZFJyU3RA==",highlighted:'{<span class="hljs-number">0</span>: <span class="hljs-string">&#x27;NEGATIVE&#x27;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>}',wrap:!1}}),Y=new Gs({props:{$$slots:{default:[Jn]},$$scope:{ctx:d}}}),{c(){t=f("meta"),i=p(),l=f("p"),r=p(),T(u.$$.fragment),o=p(),T(j.$$.fragment),yl=p(),$.c(),sl=p(),T(P.$$.fragment),bl=p(),k.c(),nl=p(),K=f("p"),K.innerHTML=It,Tl=p(),T(O.$$.fragment),hl=p(),ee=f("p"),ee.textContent=gt,Jl=p(),T(le.$$.fragment),Ul=p(),te=f("p"),te.innerHTML=vt,jl=p(),X=f("div"),X.innerHTML=At,wl=p(),se=f("p"),se.textContent=xt,_l=p(),T(ne.$$.fragment),$l=p(),ae=f("p"),ae.innerHTML=zt,Cl=p(),ie=f("ul"),ie.innerHTML=Qt,kl=p(),oe=f("p"),oe.innerHTML=Dt,Il=p(),re=f("p"),re.innerHTML=Nt,gl=p(),T(pe.$$.fragment),vl=p(),ce=f("p"),ce.textContent=Et,Al=p(),ue=f("p"),ue.innerHTML=Gt,xl=p(),me=f("p"),me.innerHTML=Vt,zl=p(),g.c(),al=p(),Me=f("p"),Me.textContent=Zt,Ql=p(),A.c(),il=p(),de=f("p"),de.innerHTML=St,Dl=p(),T(fe.$$.fragment),Nl=p(),z.c(),ol=p(),ye=f("p"),ye.textContent=Ht,El=p(),be=f("p"),be.innerHTML=Rt,Gl=p(),Te=f("p"),Te.textContent=Wt,Vl=p(),he=f("p"),he.innerHTML=Lt,Zl=p(),T(Je.$$.fragment),Sl=p(),Ue=f("p"),Ue.textContent=Bt,Hl=p(),je=f("ul"),je.innerHTML=Ft,Rl=p(),we=f("p"),we.textContent=Pt,Wl=p(),_e=f("p"),_e.textContent=Xt,Ll=p(),D.c(),rl=p(),$e=f("p"),$e.innerHTML=qt,Bl=p(),T(Ce.$$.fragment),Fl=p(),ke=f("p"),ke.textContent=Yt,Pl=p(),q=f("div"),q.innerHTML=Kt,Xl=p(),Ie=f("p"),Ie.textContent=Ot,ql=p(),ge=f("p"),ge.textContent=es,Yl=p(),ve=f("p"),ve.textContent=ls,Kl=p(),Ae=f("ul"),Ae.innerHTML=ts,Ol=p(),E.c(),pl=p(),xe=f("p"),xe.textContent=ss,et=p(),T(ze.$$.fragment),lt=p(),V.c(),cl=p(),Qe=f("p"),Qe.textContent=ns,tt=p(),T(De.$$.fragment),st=p(),Ne=f("p"),Ne.textContent=as,nt=p(),T(Ee.$$.fragment),at=p(),S.c(),ul=p(),Ge=f("p"),Ge.innerHTML=is,it=p(),R.c(),ml=p(),L.c(),Ml=p(),Ve=f("p"),Ve.innerHTML=os,ot=p(),Ze=f("p"),Ze.innerHTML=rs,rt=p(),T(Se.$$.fragment),pt=p(),T(He.$$.fragment),ct=p(),Re=f("p"),Re.textContent=ps,ut=p(),We=f("ul"),We.innerHTML=cs,mt=p(),Le=f("p"),Le.textContent=us,Mt=p(),T(Y.$$.fragment),dt=p(),fl=f("p"),this.h()},l(e){const s=Fs("svelte-u9bgzb",document.head);t=y(s,"META",{name:!0,content:!0}),s.forEach(n),i=c(e),l=y(e,"P",{}),Es(l).forEach(n),r=c(e),h(u.$$.fragment,e),o=c(e),h(j.$$.fragment,e),yl=c(e),$.l(e),sl=c(e),h(P.$$.fragment,e),bl=c(e),k.l(e),nl=c(e),K=y(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-151gkcr"&&(K.innerHTML=It),Tl=c(e),h(O.$$.fragment,e),hl=c(e),ee=y(e,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-exo8xh"&&(ee.textContent=gt),Jl=c(e),h(le.$$.fragment,e),Ul=c(e),te=y(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-1qe8xdh"&&(te.innerHTML=vt),jl=c(e),X=y(e,"DIV",{class:!0,"data-svelte-h":!0}),b(X)!=="svelte-1bcdsk7"&&(X.innerHTML=At),wl=c(e),se=y(e,"P",{"data-svelte-h":!0}),b(se)!=="svelte-1gy2qph"&&(se.textContent=xt),_l=c(e),h(ne.$$.fragment,e),$l=c(e),ae=y(e,"P",{"data-svelte-h":!0}),b(ae)!=="svelte-9pzy30"&&(ae.innerHTML=zt),Cl=c(e),ie=y(e,"UL",{"data-svelte-h":!0}),b(ie)!=="svelte-6217uj"&&(ie.innerHTML=Qt),kl=c(e),oe=y(e,"P",{"data-svelte-h":!0}),b(oe)!=="svelte-nu4tuu"&&(oe.innerHTML=Dt),Il=c(e),re=y(e,"P",{"data-svelte-h":!0}),b(re)!=="svelte-1kbz7hd"&&(re.innerHTML=Nt),gl=c(e),h(pe.$$.fragment,e),vl=c(e),ce=y(e,"P",{"data-svelte-h":!0}),b(ce)!=="svelte-x437dh"&&(ce.textContent=Et),Al=c(e),ue=y(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-mg2zx7"&&(ue.innerHTML=Gt),xl=c(e),me=y(e,"P",{"data-svelte-h":!0}),b(me)!=="svelte-5yo1cd"&&(me.innerHTML=Vt),zl=c(e),g.l(e),al=c(e),Me=y(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-1ry6kqr"&&(Me.textContent=Zt),Ql=c(e),A.l(e),il=c(e),de=y(e,"P",{"data-svelte-h":!0}),b(de)!=="svelte-1w6kfn9"&&(de.innerHTML=St),Dl=c(e),h(fe.$$.fragment,e),Nl=c(e),z.l(e),ol=c(e),ye=y(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-savfl5"&&(ye.textContent=Ht),El=c(e),be=y(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-lczy69"&&(be.innerHTML=Rt),Gl=c(e),Te=y(e,"P",{"data-svelte-h":!0}),b(Te)!=="svelte-7ig53h"&&(Te.textContent=Wt),Vl=c(e),he=y(e,"P",{"data-svelte-h":!0}),b(he)!=="svelte-eqteqf"&&(he.innerHTML=Lt),Zl=c(e),h(Je.$$.fragment,e),Sl=c(e),Ue=y(e,"P",{"data-svelte-h":!0}),b(Ue)!=="svelte-12i73ac"&&(Ue.textContent=Bt),Hl=c(e),je=y(e,"UL",{"data-svelte-h":!0}),b(je)!=="svelte-1tsv60u"&&(je.innerHTML=Ft),Rl=c(e),we=y(e,"P",{"data-svelte-h":!0}),b(we)!=="svelte-1d9p2vz"&&(we.textContent=Pt),Wl=c(e),_e=y(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-lrpjbq"&&(_e.textContent=Xt),Ll=c(e),D.l(e),rl=c(e),$e=y(e,"P",{"data-svelte-h":!0}),b($e)!=="svelte-1fa661h"&&($e.innerHTML=qt),Bl=c(e),h(Ce.$$.fragment,e),Fl=c(e),ke=y(e,"P",{"data-svelte-h":!0}),b(ke)!=="svelte-16uw2ui"&&(ke.textContent=Yt),Pl=c(e),q=y(e,"DIV",{class:!0,"data-svelte-h":!0}),b(q)!=="svelte-d4xqhj"&&(q.innerHTML=Kt),Xl=c(e),Ie=y(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-1w20y4v"&&(Ie.textContent=Ot),ql=c(e),ge=y(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-19gy4mg"&&(ge.textContent=es),Yl=c(e),ve=y(e,"P",{"data-svelte-h":!0}),b(ve)!=="svelte-1ufibh0"&&(ve.textContent=ls),Kl=c(e),Ae=y(e,"UL",{"data-svelte-h":!0}),b(Ae)!=="svelte-1vbui3x"&&(Ae.innerHTML=ts),Ol=c(e),E.l(e),pl=c(e),xe=y(e,"P",{"data-svelte-h":!0}),b(xe)!=="svelte-1s9g5wu"&&(xe.textContent=ss),et=c(e),h(ze.$$.fragment,e),lt=c(e),V.l(e),cl=c(e),Qe=y(e,"P",{"data-svelte-h":!0}),b(Qe)!=="svelte-1h2plev"&&(Qe.textContent=ns),tt=c(e),h(De.$$.fragment,e),st=c(e),Ne=y(e,"P",{"data-svelte-h":!0}),b(Ne)!=="svelte-61xkfb"&&(Ne.textContent=as),nt=c(e),h(Ee.$$.fragment,e),at=c(e),S.l(e),ul=c(e),Ge=y(e,"P",{"data-svelte-h":!0}),b(Ge)!=="svelte-seb2ta"&&(Ge.innerHTML=is),it=c(e),R.l(e),ml=c(e),L.l(e),Ml=c(e),Ve=y(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-67oj2y"&&(Ve.innerHTML=os),ot=c(e),Ze=y(e,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-1oq61oo"&&(Ze.innerHTML=rs),rt=c(e),h(Se.$$.fragment,e),pt=c(e),h(He.$$.fragment,e),ct=c(e),Re=y(e,"P",{"data-svelte-h":!0}),b(Re)!=="svelte-16tfjws"&&(Re.textContent=ps),ut=c(e),We=y(e,"UL",{"data-svelte-h":!0}),b(We)!=="svelte-vj1gli"&&(We.innerHTML=cs),mt=c(e),Le=y(e,"P",{"data-svelte-h":!0}),b(Le)!=="svelte-4jy107"&&(Le.textContent=us),Mt=c(e),h(Y.$$.fragment,e),dt=c(e),fl=y(e,"P",{}),Es(fl).forEach(n),this.h()},h(){yt(t,"name","hf:doc:metadata"),yt(t,"content",jn),yt(X,"class","flex justify-center"),yt(q,"class","flex justify-center")},m(e,s){Ps(document.head,t),a(e,i,s),a(e,l,s),a(e,r,s),J(u,e,s),a(e,o,s),J(j,e,s),a(e,yl,s),Be[_].m(e,s),a(e,sl,s),J(P,e,s),a(e,bl,s),Fe[C].m(e,s),a(e,nl,s),a(e,K,s),a(e,Tl,s),J(O,e,s),a(e,hl,s),a(e,ee,s),a(e,Jl,s),J(le,e,s),a(e,Ul,s),a(e,te,s),a(e,jl,s),a(e,X,s),a(e,wl,s),a(e,se,s),a(e,_l,s),J(ne,e,s),a(e,$l,s),a(e,ae,s),a(e,Cl,s),a(e,ie,s),a(e,kl,s),a(e,oe,s),a(e,Il,s),a(e,re,s),a(e,gl,s),J(pe,e,s),a(e,vl,s),a(e,ce,s),a(e,Al,s),a(e,ue,s),a(e,xl,s),a(e,me,s),a(e,zl,s),Pe[I].m(e,s),a(e,al,s),a(e,Me,s),a(e,Ql,s),Xe[v].m(e,s),a(e,il,s),a(e,de,s),a(e,Dl,s),J(fe,e,s),a(e,Nl,s),qe[x].m(e,s),a(e,ol,s),a(e,ye,s),a(e,El,s),a(e,be,s),a(e,Gl,s),a(e,Te,s),a(e,Vl,s),a(e,he,s),a(e,Zl,s),J(Je,e,s),a(e,Sl,s),a(e,Ue,s),a(e,Hl,s),a(e,je,s),a(e,Rl,s),a(e,we,s),a(e,Wl,s),a(e,_e,s),a(e,Ll,s),Ye[Q].m(e,s),a(e,rl,s),a(e,$e,s),a(e,Bl,s),J(Ce,e,s),a(e,Fl,s),a(e,ke,s),a(e,Pl,s),a(e,q,s),a(e,Xl,s),a(e,Ie,s),a(e,ql,s),a(e,ge,s),a(e,Yl,s),a(e,ve,s),a(e,Kl,s),a(e,Ae,s),a(e,Ol,s),Ke[N].m(e,s),a(e,pl,s),a(e,xe,s),a(e,et,s),J(ze,e,s),a(e,lt,s),Oe[G].m(e,s),a(e,cl,s),a(e,Qe,s),a(e,tt,s),J(De,e,s),a(e,st,s),a(e,Ne,s),a(e,nt,s),J(Ee,e,s),a(e,at,s),el[Z].m(e,s),a(e,ul,s),a(e,Ge,s),a(e,it,s),ll[H].m(e,s),a(e,ml,s),tl[W].m(e,s),a(e,Ml,s),a(e,Ve,s),a(e,ot,s),a(e,Ze,s),a(e,rt,s),J(Se,e,s),a(e,pt,s),J(He,e,s),a(e,ct,s),a(e,Re,s),a(e,ut,s),a(e,We,s),a(e,mt,s),a(e,Le,s),a(e,Mt,s),J(Y,e,s),a(e,dt,s),a(e,fl,s),ft=!0},p(e,[s]){const Qs={};s&1&&(Qs.fw=e[0]),u.$set(Qs);let bt=_;_=Ms(e),_!==bt&&(F(),m(Be[bt],1,1,()=>{Be[bt]=null}),B(),$=Be[_],$||($=Be[_]=ms[_](e),$.c()),M($,1),$.m(sl.parentNode,sl));const Ds={};s&2&&(Ds.$$scope={dirty:s,ctx:e}),P.$set(Ds);let Tt=C;C=fs(e),C!==Tt&&(F(),m(Fe[Tt],1,1,()=>{Fe[Tt]=null}),B(),k=Fe[C],k||(k=Fe[C]=ds[C](e),k.c()),M(k,1),k.m(nl.parentNode,nl));let ht=I;I=bs(e),I!==ht&&(F(),m(Pe[ht],1,1,()=>{Pe[ht]=null}),B(),g=Pe[I],g||(g=Pe[I]=ys[I](e),g.c()),M(g,1),g.m(al.parentNode,al));let Jt=v;v=hs(e),v!==Jt&&(F(),m(Xe[Jt],1,1,()=>{Xe[Jt]=null}),B(),A=Xe[v],A||(A=Xe[v]=Ts[v](e),A.c()),M(A,1),A.m(il.parentNode,il));let Ut=x;x=Us(e),x!==Ut&&(F(),m(qe[Ut],1,1,()=>{qe[Ut]=null}),B(),z=qe[x],z||(z=qe[x]=Js[x](e),z.c()),M(z,1),z.m(ol.parentNode,ol));let jt=Q;Q=ws(e),Q!==jt&&(F(),m(Ye[jt],1,1,()=>{Ye[jt]=null}),B(),D=Ye[Q],D||(D=Ye[Q]=js[Q](e),D.c()),M(D,1),D.m(rl.parentNode,rl));let wt=N;N=$s(e),N!==wt&&(F(),m(Ke[wt],1,1,()=>{Ke[wt]=null}),B(),E=Ke[N],E||(E=Ke[N]=_s[N](e),E.c()),M(E,1),E.m(pl.parentNode,pl));let _t=G;G=ks(e),G!==_t&&(F(),m(Oe[_t],1,1,()=>{Oe[_t]=null}),B(),V=Oe[G],V||(V=Oe[G]=Cs[G](e),V.c()),M(V,1),V.m(cl.parentNode,cl));let $t=Z;Z=gs(e),Z!==$t&&(F(),m(el[$t],1,1,()=>{el[$t]=null}),B(),S=el[Z],S||(S=el[Z]=Is[Z](e),S.c()),M(S,1),S.m(ul.parentNode,ul));let Ct=H;H=As(e),H!==Ct&&(F(),m(ll[Ct],1,1,()=>{ll[Ct]=null}),B(),R=ll[H],R||(R=ll[H]=vs[H](e),R.c()),M(R,1),R.m(ml.parentNode,ml));let kt=W;W=zs(e),W!==kt&&(F(),m(tl[kt],1,1,()=>{tl[kt]=null}),B(),L=tl[W],L||(L=tl[W]=xs[W](e),L.c()),M(L,1),L.m(Ml.parentNode,Ml));const Ns={};s&2&&(Ns.$$scope={dirty:s,ctx:e}),Y.$set(Ns)},i(e){ft||(M(u.$$.fragment,e),M(j.$$.fragment,e),M($),M(P.$$.fragment,e),M(k),M(O.$$.fragment,e),M(le.$$.fragment,e),M(ne.$$.fragment,e),M(pe.$$.fragment,e),M(g),M(A),M(fe.$$.fragment,e),M(z),M(Je.$$.fragment,e),M(D),M(Ce.$$.fragment,e),M(E),M(ze.$$.fragment,e),M(V),M(De.$$.fragment,e),M(Ee.$$.fragment,e),M(S),M(R),M(L),M(Se.$$.fragment,e),M(He.$$.fragment,e),M(Y.$$.fragment,e),ft=!0)},o(e){m(u.$$.fragment,e),m(j.$$.fragment,e),m($),m(P.$$.fragment,e),m(k),m(O.$$.fragment,e),m(le.$$.fragment,e),m(ne.$$.fragment,e),m(pe.$$.fragment,e),m(g),m(A),m(fe.$$.fragment,e),m(z),m(Je.$$.fragment,e),m(D),m(Ce.$$.fragment,e),m(E),m(ze.$$.fragment,e),m(V),m(De.$$.fragment,e),m(Ee.$$.fragment,e),m(S),m(R),m(L),m(Se.$$.fragment,e),m(He.$$.fragment,e),m(Y.$$.fragment,e),ft=!1},d(e){e&&(n(i),n(l),n(r),n(o),n(yl),n(sl),n(bl),n(nl),n(K),n(Tl),n(hl),n(ee),n(Jl),n(Ul),n(te),n(jl),n(X),n(wl),n(se),n(_l),n($l),n(ae),n(Cl),n(ie),n(kl),n(oe),n(Il),n(re),n(gl),n(vl),n(ce),n(Al),n(ue),n(xl),n(me),n(zl),n(al),n(Me),n(Ql),n(il),n(de),n(Dl),n(Nl),n(ol),n(ye),n(El),n(be),n(Gl),n(Te),n(Vl),n(he),n(Zl),n(Sl),n(Ue),n(Hl),n(je),n(Rl),n(we),n(Wl),n(_e),n(Ll),n(rl),n($e),n(Bl),n(Fl),n(ke),n(Pl),n(q),n(Xl),n(Ie),n(ql),n(ge),n(Yl),n(ve),n(Kl),n(Ae),n(Ol),n(pl),n(xe),n(et),n(lt),n(cl),n(Qe),n(tt),n(st),n(Ne),n(nt),n(at),n(ul),n(Ge),n(it),n(ml),n(Ml),n(Ve),n(ot),n(Ze),n(rt),n(pt),n(ct),n(Re),n(ut),n(We),n(mt),n(Le),n(Mt),n(dt),n(fl)),n(t),U(u,e),U(j,e),Be[_].d(e),U(P,e),Fe[C].d(e),U(O,e),U(le,e),U(ne,e),U(pe,e),Pe[I].d(e),Xe[v].d(e),U(fe,e),qe[x].d(e),U(Je,e),Ye[Q].d(e),U(Ce,e),Ke[N].d(e),U(ze,e),Oe[G].d(e),U(De,e),U(Ee,e),el[Z].d(e),ll[H].d(e),tl[W].d(e),U(Se,e),U(He,e),U(Y,e)}}}const jn='{"title":"Dietro la pipeline","local":"dietro-la-pipeline","sections":[{"title":"Preelaborazione con un tokenizer","local":"preelaborazione-con-un-tokenizer","sections":[],"depth":2},{"title":"Passare attraverso il modello","local":"passare-attraverso-il-modello","sections":[{"title":"Un vettore ad alta dimensionalità?","local":"un-vettore-ad-alta-dimensionalità","sections":[],"depth":3},{"title":"Model heads: Dare un senso ai numeri","local":"model-heads-dare-un-senso-ai-numeri","sections":[],"depth":3}],"depth":2},{"title":"Postprocessing the output","local":"postprocessing-the-output","sections":[],"depth":2}],"depth":1}';function wn(d,t,i){let l="pt";return Ws(()=>{const r=new URLSearchParams(window.location.search);i(0,l=r.get("fw")||"pt")}),[l]}class xn extends Ls{constructor(t){super(),Bs(this,t,wn,Un,Rs,{})}}export{xn as component};
