import{s as Fs,o as qs}from"../chunks/scheduler.cc52f4b9.js";import{S as Ps,i as Xs,e as f,s as p,c as T,h as Ys,a as y,d as n,b as c,f as Ss,g as h,j as b,k as Jl,l as Ks,m as a,n as J,o as m,u as B,t as M,p as U,q as Rs,r as Ws,v as F}from"../chunks/index.d2856393.js";import{T as Hs}from"../chunks/Tip.a5bdccc4.js";import{C as Os,H as yt,E as en}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8ffb7edb.js";import{Y as Ls}from"../chunks/Youtube.00df107c.js";import{C as w}from"../chunks/CodeBlock.5f8dc025.js";import{D as Bs}from"../chunks/DocNotebookDropdown.2340b131.js";import{F as tn}from"../chunks/FrameworkSwitchCourse.22a5e932.js";function ln(d){let l,i;return l=new Bs({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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function sn(d){let l,i;return l=new Bs({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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function nn(d){let l;return{c(){l=Rs("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){l=Ws(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,t){a(i,l,t)},d(i){i&&n(l)}}}function an(d){let l,i;return l=new Ls({props:{id:"wVN12smEvqg"}}),{c(){T(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function on(d){let l,i;return l=new Ls({props:{id:"1pedAIvTWXk"}}),{c(){T(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function rn(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function pn(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function cn(d){let l,i="Ecco come appaiono i risultati come tensori TensorFlow:",t,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(){l=f("p"),l.textContent=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-rb7hpw"&&(l.textContent=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function un(d){let l,i="Ecco come appaiono i risultati come tensori PyTorch:",t,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(){l=f("p"),l.textContent=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-1e7hvq4"&&(l.textContent=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function mn(d){let l,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>:",t,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(){l=f("p"),l.innerHTML=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-168vw5"&&(l.innerHTML=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function Mn(d){let l,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>:",t,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(){l=f("p"),l.innerHTML=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-19bwkio"&&(l.innerHTML=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function dn(d){let l,i,t,r;return l=new w({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFwcmludChvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlLnNoYXBlKQ==",highlighted:`outputs = model(inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),t=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(l.$$.fragment),i=p(),T(t.$$.fragment)},l(u){h(l.$$.fragment,u),i=c(u),h(t.$$.fragment,u)},m(u,o){J(l,u,o),a(u,i,o),J(t,u,o),r=!0},i(u){r||(M(l.$$.fragment,u),M(t.$$.fragment,u),r=!0)},o(u){m(l.$$.fragment,u),m(t.$$.fragment,u),r=!1},d(u){u&&n(i),U(l,u),U(t,u)}}}function fn(d){let l,i,t,r;return l=new w({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQXByaW50KG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUuc2hhcGUp",highlighted:`outputs = model(**inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),t=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(l.$$.fragment),i=p(),T(t.$$.fragment)},l(u){h(l.$$.fragment,u),i=c(u),h(t.$$.fragment,u)},m(u,o){J(l,u,o),a(u,i,o),J(t,u,o),r=!0},i(u){r||(M(l.$$.fragment,u),M(t.$$.fragment,u),r=!0)},o(u){m(l.$$.fragment,u),m(t.$$.fragment,u),r=!1},d(u){u&&n(i),U(l,u),U(t,u)}}}function yn(d){let l,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>:",t,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(){l=f("p"),l.innerHTML=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-1jd8c81"&&(l.innerHTML=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function bn(d){let l,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>:",t,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(){l=f("p"),l.innerHTML=i,t=p(),T(r.$$.fragment)},l(o){l=y(o,"P",{"data-svelte-h":!0}),b(l)!=="svelte-btrap5"&&(l.innerHTML=i),t=c(o),h(r.$$.fragment,o)},m(o,j){a(o,l,j),a(o,t,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(l),n(t)),U(r,o)}}}function Tn(d){let l,i;return l=new w({props:{code:"KDIlMkMlMjAyKQ==",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)',wrap:!1}}),{c(){T(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function hn(d){let l,i;return l=new w({props:{code:"dG9yY2guU2l6ZSglNUIyJTJDJTIwMiU1RCk=",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">2</span>])',wrap:!1}}),{c(){T(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function Jn(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function Un(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function jn(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function wn(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function $n(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function _n(d){let l,i;return l=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(l.$$.fragment)},l(t){h(l.$$.fragment,t)},m(t,r){J(l,t,r),i=!0},i(t){i||(M(l.$$.fragment,t),i=!0)},o(t){m(l.$$.fragment,t),i=!1},d(t){U(l,t)}}}function Cn(d){let l;return{c(){l=Rs("✏️ **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){l=Ws(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,t){a(i,l,t)},d(i){i&&n(l)}}}function kn(d){let l,i,t,r,u,o,j,Tt,K,ht,$,_,at,q,Jt,C,k,it,O,xl='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>:',Ut,ee,jt,te,zl="e ottenuto:",wt,le,$t,se,Ql='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:',_t,P,Dl='<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.."/>',Ct,ne,Nl="Esaminiamo rapidamente ciascuno di essi.",kt,ae,gt,ie,El="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:",It,oe,Gl="<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>",vt,re,Vl='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).',At,pe,Zl='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:',xt,ce,zt,ue,Sl="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.",Qt,me,Hl="È 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.",Dt,Me,Rl="Per specificare il tipo di tensori che vogliamo ottenere (PyTorch, TensorFlow o NumPy), usiamo l’argomento <code>return_tensors</code>:",Nt,g,I,ot,de,Wl="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).",Et,v,A,rt,fe,Ll="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.",Gt,ye,Vt,x,z,pt,be,Bl="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.",Zt,Te,Fl="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>.",St,he,ql="Se per te tutto questo non ha senso, non preoccuparti. Ti spiegheremo tutto più avanti.",Ht,Je,Pl='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.',Rt,Ue,Wt,je,Xl="Il vettore emesso dal modulo Transformer è solitamente di grandi dimensioni. In genere ha tre dimensioni:",Lt,we,Yl="<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>",Bt,$e,Kl="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ù).",Ft,_e,Ol="Lo possiamo vedere se alimentiamo il nostro modello con gli input che abbiamo preelaborato:",qt,Q,D,ct,Ce,es="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>).",Pt,ke,Xt,ge,ts="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:",Yt,X,ls='<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."/>',Kt,Ie,ss="Gli output del modello Transformer vengono inviati direttamente alla model head per essere elaborati.",Ot,ve,ns="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.",el,Ae,as="Esistono diverse architetture disponibili nei 🤗 Transformers, ognuna delle quali è stata progettata per affrontare un compito specifico. Ecco un elenco non esaustivo:",tl,xe,is="<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>",ll,N,E,ut,ze,os="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):",sl,Qe,nl,G,V,mt,De,rs="Dato che abbiamo solo due frasi e due etichette, il risultato che otteniamo dal nostro modello è di forma 2 x 2.",al,Ne,il,Ee,ps="I valori che otteniamo come output dal nostro modello non hanno necessariamente senso da soli. Diamo un’occhiata:",ol,Ge,rl,Z,S,Mt,Ve,cs='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):',pl,H,R,dt,W,L,ft,Ze,us="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.",cl,Se,ms="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):",ul,He,ml,Re,Ml,We,Ms="Ora possiamo concludere che il modello ha previsto quanto segue:",dl,Le,ds="<li>Prima frase: NEGATIVE: 0.0402, POSITIVE: 0.9598</li> <li>Seconda frase: NEGATIVE: 0.9995, POSITIVE: 0.0005</li>",fl,Be,fs="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.",yl,Y,bl,Fe,Tl,bt,hl;u=new tn({props:{fw:d[0]}}),j=new Os({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),K=new yt({props:{title:"Dietro la pipeline",local:"dietro-la-pipeline",headingTag:"h1"}});const ys=[sn,ln],qe=[];function bs(e,s){return e[0]==="pt"?0:1}$=bs(d),_=qe[$]=ys[$](d),q=new Hs({props:{$$slots:{default:[nn]},$$scope:{ctx:d}}});const Ts=[on,an],Pe=[];function hs(e,s){return e[0]==="pt"?0:1}C=hs(d),k=Pe[C]=Ts[C](d),ee=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}}),ae=new yt({props:{title:"Preelaborazione con un tokenizer",local:"preelaborazione-con-un-tokenizer",headingTag:"h2"}}),ce=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 Js=[pn,rn],Xe=[];function Us(e,s){return e[0]==="pt"?0:1}g=Us(d),I=Xe[g]=Js[g](d);const js=[un,cn],Ye=[];function ws(e,s){return e[0]==="pt"?0:1}v=ws(d),A=Ye[v]=js[v](d),ye=new yt({props:{title:"Passare attraverso il modello",local:"passare-attraverso-il-modello",headingTag:"h2"}});const $s=[Mn,mn],Ke=[];function _s(e,s){return e[0]==="pt"?0:1}x=_s(d),z=Ke[x]=$s[x](d),Ue=new yt({props:{title:"Un vettore ad alta dimensionalità?",local:"un-vettore-ad-alta-dimensionalità",headingTag:"h3"}});const Cs=[fn,dn],Oe=[];function ks(e,s){return e[0]==="pt"?0:1}Q=ks(d),D=Oe[Q]=Cs[Q](d),ke=new yt({props:{title:"Model heads: Dare un senso ai numeri",local:"model-heads-dare-un-senso-ai-numeri",headingTag:"h3"}});const gs=[bn,yn],et=[];function Is(e,s){return e[0]==="pt"?0:1}N=Is(d),E=et[N]=gs[N](d),Qe=new w({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMuc2hhcGUp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)',wrap:!1}});const vs=[hn,Tn],tt=[];function As(e,s){return e[0]==="pt"?0:1}G=As(d),V=tt[G]=vs[G](d),Ne=new yt({props:{title:"Postprocessing the output",local:"postprocessing-the-output",headingTag:"h2"}}),Ge=new w({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)',wrap:!1}});const xs=[Un,Jn],lt=[];function zs(e,s){return e[0]==="pt"?0:1}Z=zs(d),S=lt[Z]=xs[Z](d);const Qs=[wn,jn],st=[];function Ds(e,s){return e[0]==="pt"?0:1}H=Ds(d),R=st[H]=Qs[H](d);const Ns=[_n,$n],nt=[];function Es(e,s){return e[0]==="pt"?0:1}return W=Es(d),L=nt[W]=Ns[W](d),He=new w({props:{code:"bW9kZWwuY29uZmlnLmlkMmxhYmVs",highlighted:"model.config.id2label",wrap:!1}}),Re=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 Hs({props:{$$slots:{default:[Cn]},$$scope:{ctx:d}}}),Fe=new en({props:{source:"https://github.com/huggingface/course/blob/main/chapters/it/chapter2/2.mdx"}}),{c(){l=f("meta"),i=p(),t=f("p"),r=p(),T(u.$$.fragment),o=p(),T(j.$$.fragment),Tt=p(),T(K.$$.fragment),ht=p(),_.c(),at=p(),T(q.$$.fragment),Jt=p(),k.c(),it=p(),O=f("p"),O.innerHTML=xl,Ut=p(),T(ee.$$.fragment),jt=p(),te=f("p"),te.textContent=zl,wt=p(),T(le.$$.fragment),$t=p(),se=f("p"),se.innerHTML=Ql,_t=p(),P=f("div"),P.innerHTML=Dl,Ct=p(),ne=f("p"),ne.textContent=Nl,kt=p(),T(ae.$$.fragment),gt=p(),ie=f("p"),ie.innerHTML=El,It=p(),oe=f("ul"),oe.innerHTML=Gl,vt=p(),re=f("p"),re.innerHTML=Vl,At=p(),pe=f("p"),pe.innerHTML=Zl,xt=p(),T(ce.$$.fragment),zt=p(),ue=f("p"),ue.textContent=Sl,Qt=p(),me=f("p"),me.innerHTML=Hl,Dt=p(),Me=f("p"),Me.innerHTML=Rl,Nt=p(),I.c(),ot=p(),de=f("p"),de.textContent=Wl,Et=p(),A.c(),rt=p(),fe=f("p"),fe.innerHTML=Ll,Gt=p(),T(ye.$$.fragment),Vt=p(),z.c(),pt=p(),be=f("p"),be.textContent=Bl,Zt=p(),Te=f("p"),Te.innerHTML=Fl,St=p(),he=f("p"),he.textContent=ql,Ht=p(),Je=f("p"),Je.innerHTML=Pl,Rt=p(),T(Ue.$$.fragment),Wt=p(),je=f("p"),je.textContent=Xl,Lt=p(),we=f("ul"),we.innerHTML=Yl,Bt=p(),$e=f("p"),$e.textContent=Kl,Ft=p(),_e=f("p"),_e.textContent=Ol,qt=p(),D.c(),ct=p(),Ce=f("p"),Ce.innerHTML=es,Pt=p(),T(ke.$$.fragment),Xt=p(),ge=f("p"),ge.textContent=ts,Yt=p(),X=f("div"),X.innerHTML=ls,Kt=p(),Ie=f("p"),Ie.textContent=ss,Ot=p(),ve=f("p"),ve.textContent=ns,el=p(),Ae=f("p"),Ae.textContent=as,tl=p(),xe=f("ul"),xe.innerHTML=is,ll=p(),E.c(),ut=p(),ze=f("p"),ze.textContent=os,sl=p(),T(Qe.$$.fragment),nl=p(),V.c(),mt=p(),De=f("p"),De.textContent=rs,al=p(),T(Ne.$$.fragment),il=p(),Ee=f("p"),Ee.textContent=ps,ol=p(),T(Ge.$$.fragment),rl=p(),S.c(),Mt=p(),Ve=f("p"),Ve.innerHTML=cs,pl=p(),R.c(),dt=p(),L.c(),ft=p(),Ze=f("p"),Ze.innerHTML=us,cl=p(),Se=f("p"),Se.innerHTML=ms,ul=p(),T(He.$$.fragment),ml=p(),T(Re.$$.fragment),Ml=p(),We=f("p"),We.textContent=Ms,dl=p(),Le=f("ul"),Le.innerHTML=ds,fl=p(),Be=f("p"),Be.textContent=fs,yl=p(),T(Y.$$.fragment),bl=p(),T(Fe.$$.fragment),Tl=p(),bt=f("p"),this.h()},l(e){const s=Ys("svelte-u9bgzb",document.head);l=y(s,"META",{name:!0,content:!0}),s.forEach(n),i=c(e),t=y(e,"P",{}),Ss(t).forEach(n),r=c(e),h(u.$$.fragment,e),o=c(e),h(j.$$.fragment,e),Tt=c(e),h(K.$$.fragment,e),ht=c(e),_.l(e),at=c(e),h(q.$$.fragment,e),Jt=c(e),k.l(e),it=c(e),O=y(e,"P",{"data-svelte-h":!0}),b(O)!=="svelte-151gkcr"&&(O.innerHTML=xl),Ut=c(e),h(ee.$$.fragment,e),jt=c(e),te=y(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-exo8xh"&&(te.textContent=zl),wt=c(e),h(le.$$.fragment,e),$t=c(e),se=y(e,"P",{"data-svelte-h":!0}),b(se)!=="svelte-1qe8xdh"&&(se.innerHTML=Ql),_t=c(e),P=y(e,"DIV",{class:!0,"data-svelte-h":!0}),b(P)!=="svelte-1bcdsk7"&&(P.innerHTML=Dl),Ct=c(e),ne=y(e,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-1gy2qph"&&(ne.textContent=Nl),kt=c(e),h(ae.$$.fragment,e),gt=c(e),ie=y(e,"P",{"data-svelte-h":!0}),b(ie)!=="svelte-9pzy30"&&(ie.innerHTML=El),It=c(e),oe=y(e,"UL",{"data-svelte-h":!0}),b(oe)!=="svelte-6217uj"&&(oe.innerHTML=Gl),vt=c(e),re=y(e,"P",{"data-svelte-h":!0}),b(re)!=="svelte-nu4tuu"&&(re.innerHTML=Vl),At=c(e),pe=y(e,"P",{"data-svelte-h":!0}),b(pe)!=="svelte-1kbz7hd"&&(pe.innerHTML=Zl),xt=c(e),h(ce.$$.fragment,e),zt=c(e),ue=y(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-x437dh"&&(ue.textContent=Sl),Qt=c(e),me=y(e,"P",{"data-svelte-h":!0}),b(me)!=="svelte-mg2zx7"&&(me.innerHTML=Hl),Dt=c(e),Me=y(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-5yo1cd"&&(Me.innerHTML=Rl),Nt=c(e),I.l(e),ot=c(e),de=y(e,"P",{"data-svelte-h":!0}),b(de)!=="svelte-1ry6kqr"&&(de.textContent=Wl),Et=c(e),A.l(e),rt=c(e),fe=y(e,"P",{"data-svelte-h":!0}),b(fe)!=="svelte-1w6kfn9"&&(fe.innerHTML=Ll),Gt=c(e),h(ye.$$.fragment,e),Vt=c(e),z.l(e),pt=c(e),be=y(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-savfl5"&&(be.textContent=Bl),Zt=c(e),Te=y(e,"P",{"data-svelte-h":!0}),b(Te)!=="svelte-lczy69"&&(Te.innerHTML=Fl),St=c(e),he=y(e,"P",{"data-svelte-h":!0}),b(he)!=="svelte-7ig53h"&&(he.textContent=ql),Ht=c(e),Je=y(e,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-eqteqf"&&(Je.innerHTML=Pl),Rt=c(e),h(Ue.$$.fragment,e),Wt=c(e),je=y(e,"P",{"data-svelte-h":!0}),b(je)!=="svelte-12i73ac"&&(je.textContent=Xl),Lt=c(e),we=y(e,"UL",{"data-svelte-h":!0}),b(we)!=="svelte-1tsv60u"&&(we.innerHTML=Yl),Bt=c(e),$e=y(e,"P",{"data-svelte-h":!0}),b($e)!=="svelte-1d9p2vz"&&($e.textContent=Kl),Ft=c(e),_e=y(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-lrpjbq"&&(_e.textContent=Ol),qt=c(e),D.l(e),ct=c(e),Ce=y(e,"P",{"data-svelte-h":!0}),b(Ce)!=="svelte-1fa661h"&&(Ce.innerHTML=es),Pt=c(e),h(ke.$$.fragment,e),Xt=c(e),ge=y(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-16uw2ui"&&(ge.textContent=ts),Yt=c(e),X=y(e,"DIV",{class:!0,"data-svelte-h":!0}),b(X)!=="svelte-d4xqhj"&&(X.innerHTML=ls),Kt=c(e),Ie=y(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-1w20y4v"&&(Ie.textContent=ss),Ot=c(e),ve=y(e,"P",{"data-svelte-h":!0}),b(ve)!=="svelte-19gy4mg"&&(ve.textContent=ns),el=c(e),Ae=y(e,"P",{"data-svelte-h":!0}),b(Ae)!=="svelte-1ufibh0"&&(Ae.textContent=as),tl=c(e),xe=y(e,"UL",{"data-svelte-h":!0}),b(xe)!=="svelte-1vbui3x"&&(xe.innerHTML=is),ll=c(e),E.l(e),ut=c(e),ze=y(e,"P",{"data-svelte-h":!0}),b(ze)!=="svelte-1s9g5wu"&&(ze.textContent=os),sl=c(e),h(Qe.$$.fragment,e),nl=c(e),V.l(e),mt=c(e),De=y(e,"P",{"data-svelte-h":!0}),b(De)!=="svelte-1h2plev"&&(De.textContent=rs),al=c(e),h(Ne.$$.fragment,e),il=c(e),Ee=y(e,"P",{"data-svelte-h":!0}),b(Ee)!=="svelte-61xkfb"&&(Ee.textContent=ps),ol=c(e),h(Ge.$$.fragment,e),rl=c(e),S.l(e),Mt=c(e),Ve=y(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-seb2ta"&&(Ve.innerHTML=cs),pl=c(e),R.l(e),dt=c(e),L.l(e),ft=c(e),Ze=y(e,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-67oj2y"&&(Ze.innerHTML=us),cl=c(e),Se=y(e,"P",{"data-svelte-h":!0}),b(Se)!=="svelte-1oq61oo"&&(Se.innerHTML=ms),ul=c(e),h(He.$$.fragment,e),ml=c(e),h(Re.$$.fragment,e),Ml=c(e),We=y(e,"P",{"data-svelte-h":!0}),b(We)!=="svelte-16tfjws"&&(We.textContent=Ms),dl=c(e),Le=y(e,"UL",{"data-svelte-h":!0}),b(Le)!=="svelte-vj1gli"&&(Le.innerHTML=ds),fl=c(e),Be=y(e,"P",{"data-svelte-h":!0}),b(Be)!=="svelte-4jy107"&&(Be.textContent=fs),yl=c(e),h(Y.$$.fragment,e),bl=c(e),h(Fe.$$.fragment,e),Tl=c(e),bt=y(e,"P",{}),Ss(bt).forEach(n),this.h()},h(){Jl(l,"name","hf:doc:metadata"),Jl(l,"content",gn),Jl(P,"class","flex justify-center"),Jl(X,"class","flex justify-center")},m(e,s){Ks(document.head,l),a(e,i,s),a(e,t,s),a(e,r,s),J(u,e,s),a(e,o,s),J(j,e,s),a(e,Tt,s),J(K,e,s),a(e,ht,s),qe[$].m(e,s),a(e,at,s),J(q,e,s),a(e,Jt,s),Pe[C].m(e,s),a(e,it,s),a(e,O,s),a(e,Ut,s),J(ee,e,s),a(e,jt,s),a(e,te,s),a(e,wt,s),J(le,e,s),a(e,$t,s),a(e,se,s),a(e,_t,s),a(e,P,s),a(e,Ct,s),a(e,ne,s),a(e,kt,s),J(ae,e,s),a(e,gt,s),a(e,ie,s),a(e,It,s),a(e,oe,s),a(e,vt,s),a(e,re,s),a(e,At,s),a(e,pe,s),a(e,xt,s),J(ce,e,s),a(e,zt,s),a(e,ue,s),a(e,Qt,s),a(e,me,s),a(e,Dt,s),a(e,Me,s),a(e,Nt,s),Xe[g].m(e,s),a(e,ot,s),a(e,de,s),a(e,Et,s),Ye[v].m(e,s),a(e,rt,s),a(e,fe,s),a(e,Gt,s),J(ye,e,s),a(e,Vt,s),Ke[x].m(e,s),a(e,pt,s),a(e,be,s),a(e,Zt,s),a(e,Te,s),a(e,St,s),a(e,he,s),a(e,Ht,s),a(e,Je,s),a(e,Rt,s),J(Ue,e,s),a(e,Wt,s),a(e,je,s),a(e,Lt,s),a(e,we,s),a(e,Bt,s),a(e,$e,s),a(e,Ft,s),a(e,_e,s),a(e,qt,s),Oe[Q].m(e,s),a(e,ct,s),a(e,Ce,s),a(e,Pt,s),J(ke,e,s),a(e,Xt,s),a(e,ge,s),a(e,Yt,s),a(e,X,s),a(e,Kt,s),a(e,Ie,s),a(e,Ot,s),a(e,ve,s),a(e,el,s),a(e,Ae,s),a(e,tl,s),a(e,xe,s),a(e,ll,s),et[N].m(e,s),a(e,ut,s),a(e,ze,s),a(e,sl,s),J(Qe,e,s),a(e,nl,s),tt[G].m(e,s),a(e,mt,s),a(e,De,s),a(e,al,s),J(Ne,e,s),a(e,il,s),a(e,Ee,s),a(e,ol,s),J(Ge,e,s),a(e,rl,s),lt[Z].m(e,s),a(e,Mt,s),a(e,Ve,s),a(e,pl,s),st[H].m(e,s),a(e,dt,s),nt[W].m(e,s),a(e,ft,s),a(e,Ze,s),a(e,cl,s),a(e,Se,s),a(e,ul,s),J(He,e,s),a(e,ml,s),J(Re,e,s),a(e,Ml,s),a(e,We,s),a(e,dl,s),a(e,Le,s),a(e,fl,s),a(e,Be,s),a(e,yl,s),J(Y,e,s),a(e,bl,s),J(Fe,e,s),a(e,Tl,s),a(e,bt,s),hl=!0},p(e,[s]){const Gs={};s&1&&(Gs.fw=e[0]),u.$set(Gs);let Ul=$;$=bs(e),$!==Ul&&(F(),m(qe[Ul],1,1,()=>{qe[Ul]=null}),B(),_=qe[$],_||(_=qe[$]=ys[$](e),_.c()),M(_,1),_.m(at.parentNode,at));const Vs={};s&2&&(Vs.$$scope={dirty:s,ctx:e}),q.$set(Vs);let jl=C;C=hs(e),C!==jl&&(F(),m(Pe[jl],1,1,()=>{Pe[jl]=null}),B(),k=Pe[C],k||(k=Pe[C]=Ts[C](e),k.c()),M(k,1),k.m(it.parentNode,it));let wl=g;g=Us(e),g!==wl&&(F(),m(Xe[wl],1,1,()=>{Xe[wl]=null}),B(),I=Xe[g],I||(I=Xe[g]=Js[g](e),I.c()),M(I,1),I.m(ot.parentNode,ot));let $l=v;v=ws(e),v!==$l&&(F(),m(Ye[$l],1,1,()=>{Ye[$l]=null}),B(),A=Ye[v],A||(A=Ye[v]=js[v](e),A.c()),M(A,1),A.m(rt.parentNode,rt));let _l=x;x=_s(e),x!==_l&&(F(),m(Ke[_l],1,1,()=>{Ke[_l]=null}),B(),z=Ke[x],z||(z=Ke[x]=$s[x](e),z.c()),M(z,1),z.m(pt.parentNode,pt));let Cl=Q;Q=ks(e),Q!==Cl&&(F(),m(Oe[Cl],1,1,()=>{Oe[Cl]=null}),B(),D=Oe[Q],D||(D=Oe[Q]=Cs[Q](e),D.c()),M(D,1),D.m(ct.parentNode,ct));let kl=N;N=Is(e),N!==kl&&(F(),m(et[kl],1,1,()=>{et[kl]=null}),B(),E=et[N],E||(E=et[N]=gs[N](e),E.c()),M(E,1),E.m(ut.parentNode,ut));let gl=G;G=As(e),G!==gl&&(F(),m(tt[gl],1,1,()=>{tt[gl]=null}),B(),V=tt[G],V||(V=tt[G]=vs[G](e),V.c()),M(V,1),V.m(mt.parentNode,mt));let Il=Z;Z=zs(e),Z!==Il&&(F(),m(lt[Il],1,1,()=>{lt[Il]=null}),B(),S=lt[Z],S||(S=lt[Z]=xs[Z](e),S.c()),M(S,1),S.m(Mt.parentNode,Mt));let vl=H;H=Ds(e),H!==vl&&(F(),m(st[vl],1,1,()=>{st[vl]=null}),B(),R=st[H],R||(R=st[H]=Qs[H](e),R.c()),M(R,1),R.m(dt.parentNode,dt));let Al=W;W=Es(e),W!==Al&&(F(),m(nt[Al],1,1,()=>{nt[Al]=null}),B(),L=nt[W],L||(L=nt[W]=Ns[W](e),L.c()),M(L,1),L.m(ft.parentNode,ft));const Zs={};s&2&&(Zs.$$scope={dirty:s,ctx:e}),Y.$set(Zs)},i(e){hl||(M(u.$$.fragment,e),M(j.$$.fragment,e),M(K.$$.fragment,e),M(_),M(q.$$.fragment,e),M(k),M(ee.$$.fragment,e),M(le.$$.fragment,e),M(ae.$$.fragment,e),M(ce.$$.fragment,e),M(I),M(A),M(ye.$$.fragment,e),M(z),M(Ue.$$.fragment,e),M(D),M(ke.$$.fragment,e),M(E),M(Qe.$$.fragment,e),M(V),M(Ne.$$.fragment,e),M(Ge.$$.fragment,e),M(S),M(R),M(L),M(He.$$.fragment,e),M(Re.$$.fragment,e),M(Y.$$.fragment,e),M(Fe.$$.fragment,e),hl=!0)},o(e){m(u.$$.fragment,e),m(j.$$.fragment,e),m(K.$$.fragment,e),m(_),m(q.$$.fragment,e),m(k),m(ee.$$.fragment,e),m(le.$$.fragment,e),m(ae.$$.fragment,e),m(ce.$$.fragment,e),m(I),m(A),m(ye.$$.fragment,e),m(z),m(Ue.$$.fragment,e),m(D),m(ke.$$.fragment,e),m(E),m(Qe.$$.fragment,e),m(V),m(Ne.$$.fragment,e),m(Ge.$$.fragment,e),m(S),m(R),m(L),m(He.$$.fragment,e),m(Re.$$.fragment,e),m(Y.$$.fragment,e),m(Fe.$$.fragment,e),hl=!1},d(e){e&&(n(i),n(t),n(r),n(o),n(Tt),n(ht),n(at),n(Jt),n(it),n(O),n(Ut),n(jt),n(te),n(wt),n($t),n(se),n(_t),n(P),n(Ct),n(ne),n(kt),n(gt),n(ie),n(It),n(oe),n(vt),n(re),n(At),n(pe),n(xt),n(zt),n(ue),n(Qt),n(me),n(Dt),n(Me),n(Nt),n(ot),n(de),n(Et),n(rt),n(fe),n(Gt),n(Vt),n(pt),n(be),n(Zt),n(Te),n(St),n(he),n(Ht),n(Je),n(Rt),n(Wt),n(je),n(Lt),n(we),n(Bt),n($e),n(Ft),n(_e),n(qt),n(ct),n(Ce),n(Pt),n(Xt),n(ge),n(Yt),n(X),n(Kt),n(Ie),n(Ot),n(ve),n(el),n(Ae),n(tl),n(xe),n(ll),n(ut),n(ze),n(sl),n(nl),n(mt),n(De),n(al),n(il),n(Ee),n(ol),n(rl),n(Mt),n(Ve),n(pl),n(dt),n(ft),n(Ze),n(cl),n(Se),n(ul),n(ml),n(Ml),n(We),n(dl),n(Le),n(fl),n(Be),n(yl),n(bl),n(Tl),n(bt)),n(l),U(u,e),U(j,e),U(K,e),qe[$].d(e),U(q,e),Pe[C].d(e),U(ee,e),U(le,e),U(ae,e),U(ce,e),Xe[g].d(e),Ye[v].d(e),U(ye,e),Ke[x].d(e),U(Ue,e),Oe[Q].d(e),U(ke,e),et[N].d(e),U(Qe,e),tt[G].d(e),U(Ne,e),U(Ge,e),lt[Z].d(e),st[H].d(e),nt[W].d(e),U(He,e),U(Re,e),U(Y,e),U(Fe,e)}}}const gn='{"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 In(d,l,i){let t="pt";return qs(()=>{const r=new URLSearchParams(window.location.search);i(0,t=r.get("fw")||"pt")}),[t]}class Gn extends Ps{constructor(l){super(),Xs(this,l,In,kn,Fs,{})}}export{Gn as component};
