import{s as os,o as ps,n as Y}from"../chunks/scheduler.36a0863c.js";import{S as cs,i as ms,g as u,s as r,r as f,A as us,h as d,f as s,c as o,j as ns,u as g,x as j,k as is,y as ds,a,v as $,d as h,t as b,w as y}from"../chunks/index.9c13489a.js";import{T as kt}from"../chunks/Tip.3b06990e.js";import{C as q}from"../chunks/CodeBlock.05d8ec32.js";import{F as rs,M as Jt}from"../chunks/Markdown.88297c0b.js";import{H as Ce,E as fs}from"../chunks/EditOnGithub.e88f2b7b.js";function gs(Z){let l,m='Puoi anche salvare il file di configurazione come dizionario oppure come la differenza tra gli attributi della tua configurazione personalizzata e gli attributi della configurazione predefinita! Guarda la documentazione <a href="main_classes/configuration">configuration</a> per più dettagli.';return{c(){l=u("p"),l.innerHTML=m},l(n){l=d(n,"P",{"data-svelte-h":!0}),j(l)!=="svelte-15jhhcb"&&(l.innerHTML=m)},m(n,p){a(n,l,p)},p:Y,d(n){n&&s(l)}}}function $s(Z){let l,m="Carica gli attributi della tua configurazione personalizzata nel modello:",n,p,v,z,C="Questo crea modelli con valori casuali invece di pesi pre-allenati. Non sarai in grado di usare questo modello per niente di utile finché non lo alleni. L’allenamento è un processo costoso e che richiede tempo . Generalmente è meglio usare un modello pre-allenato per ottenere risultati migliori velocemente, utilizzando solo una frazione delle risorse neccesarie per l’allenamento.",k,M,w="Crea un modello pre-allenato con <code>from_pretrained()</code>:",c,_,W,J,U="Quando carichi pesi pre-allenati, la configurazione del modello predefinito è automaticamente caricata se il modello è fornito da 🤗 Transformers. Tuttavia, puoi ancora sostituire gli attributi - alcuni o tutti - di configurazione del modello predefinito con i tuoi se lo desideri:",G,R,V;return p=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRNb2RlbCUwQSUwQW15X2NvbmZpZyUyMCUzRCUyMERpc3RpbEJlcnRDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ5b3VyX21vZGVsX3NhdmVfcGF0aCUyRm15X2NvbmZpZy5qc29uJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydE1vZGVsKG15X2NvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/my_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel(my_config)`,wrap:!1}}),_=new q({props:{code:"bW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)',wrap:!1}}),R=new q({props:{code:"bW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMGNvbmZpZyUzRG15X2NvbmZpZyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, config=my_config)',wrap:!1}}),{c(){l=u("p"),l.textContent=m,n=r(),f(p.$$.fragment),v=r(),z=u("p"),z.textContent=C,k=r(),M=u("p"),M.innerHTML=w,c=r(),f(_.$$.fragment),W=r(),J=u("p"),J.textContent=U,G=r(),f(R.$$.fragment)},l(i){l=d(i,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1cmkkoy"&&(l.textContent=m),n=o(i),g(p.$$.fragment,i),v=o(i),z=d(i,"P",{"data-svelte-h":!0}),j(z)!=="svelte-zq50ce"&&(z.textContent=C),k=o(i),M=d(i,"P",{"data-svelte-h":!0}),j(M)!=="svelte-so9er"&&(M.innerHTML=w),c=o(i),g(_.$$.fragment,i),W=o(i),J=d(i,"P",{"data-svelte-h":!0}),j(J)!=="svelte-1qjkbx4"&&(J.textContent=U),G=o(i),g(R.$$.fragment,i)},m(i,T){a(i,l,T),a(i,n,T),$(p,i,T),a(i,v,T),a(i,z,T),a(i,k,T),a(i,M,T),a(i,c,T),$(_,i,T),a(i,W,T),a(i,J,T),a(i,G,T),$(R,i,T),V=!0},p:Y,i(i){V||(h(p.$$.fragment,i),h(_.$$.fragment,i),h(R.$$.fragment,i),V=!0)},o(i){b(p.$$.fragment,i),b(_.$$.fragment,i),b(R.$$.fragment,i),V=!1},d(i){i&&(s(l),s(n),s(v),s(z),s(k),s(M),s(c),s(W),s(J),s(G)),y(p,i),y(_,i),y(R,i)}}}function hs(Z){let l,m;return l=new Jt({props:{$$slots:{default:[$s]},$$scope:{ctx:Z}}}),{c(){f(l.$$.fragment)},l(n){g(l.$$.fragment,n)},m(n,p){$(l,n,p),m=!0},p(n,p){const v={};p&2&&(v.$$scope={dirty:p,ctx:n}),l.$set(v)},i(n){m||(h(l.$$.fragment,n),m=!0)},o(n){b(l.$$.fragment,n),m=!1},d(n){y(l,n)}}}function bs(Z){let l,m="Carica gli attributi di configurazione personalizzati nel modello:",n,p,v,z,C="Questo crea modelli con valori casuali invece di pesi pre-allenati. Non sarai in grado di usare questo modello per niente di utile finché non lo alleni. L’allenamento è un processo costoso e che richiede tempo . Generalmente è meglio usare un modello pre-allenato per ottenere risultati migliori velocemente, utilizzando solo una frazione delle risorse neccesarie per l’allenamento.",k,M,w="Crea un modello pre-allenoto con <code>from_pretrained()</code>:",c,_,W,J,U="Quando carichi pesi pre-allenati, la configurazione del modello predefinito è automaticamente caricato se il modello è fornito da 🤗 Transformers. Tuttavia, puoi ancora sostituire gli attributi - alcuni o tutti - di configurazione del modello predefinito con i tuoi se lo desideri:",G,R,V;return p=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydE1vZGVsJTBBJTBBbXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnlvdXJfbW9kZWxfc2F2ZV9wYXRoJTJGbXlfY29uZmlnLmpzb24lMjIpJTBBdGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbChteV9jb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/my_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel(my_config)`,wrap:!1}}),_=new q({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)',wrap:!1}}),R=new q({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyJTJDJTIwY29uZmlnJTNEbXlfY29uZmlnKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, config=my_config)',wrap:!1}}),{c(){l=u("p"),l.textContent=m,n=r(),f(p.$$.fragment),v=r(),z=u("p"),z.textContent=C,k=r(),M=u("p"),M.innerHTML=w,c=r(),f(_.$$.fragment),W=r(),J=u("p"),J.textContent=U,G=r(),f(R.$$.fragment)},l(i){l=d(i,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1hu91xr"&&(l.textContent=m),n=o(i),g(p.$$.fragment,i),v=o(i),z=d(i,"P",{"data-svelte-h":!0}),j(z)!=="svelte-zq50ce"&&(z.textContent=C),k=o(i),M=d(i,"P",{"data-svelte-h":!0}),j(M)!=="svelte-3b4nvp"&&(M.innerHTML=w),c=o(i),g(_.$$.fragment,i),W=o(i),J=d(i,"P",{"data-svelte-h":!0}),j(J)!=="svelte-16aucye"&&(J.textContent=U),G=o(i),g(R.$$.fragment,i)},m(i,T){a(i,l,T),a(i,n,T),$(p,i,T),a(i,v,T),a(i,z,T),a(i,k,T),a(i,M,T),a(i,c,T),$(_,i,T),a(i,W,T),a(i,J,T),a(i,G,T),$(R,i,T),V=!0},p:Y,i(i){V||(h(p.$$.fragment,i),h(_.$$.fragment,i),h(R.$$.fragment,i),V=!0)},o(i){b(p.$$.fragment,i),b(_.$$.fragment,i),b(R.$$.fragment,i),V=!1},d(i){i&&(s(l),s(n),s(v),s(z),s(k),s(M),s(c),s(W),s(J),s(G)),y(p,i),y(_,i),y(R,i)}}}function ys(Z){let l,m;return l=new Jt({props:{$$slots:{default:[bs]},$$scope:{ctx:Z}}}),{c(){f(l.$$.fragment)},l(n){g(l.$$.fragment,n)},m(n,p){$(l,n,p),m=!0},p(n,p){const v={};p&2&&(v.$$scope={dirty:p,ctx:n}),l.$set(v)},i(n){m||(h(l.$$.fragment,n),m=!0)},o(n){b(l.$$.fragment,n),m=!1},d(n){y(l,n)}}}function js(Z){let l,m="Per esempio, <code>DistilBertForSequenceClassification</code> è un modello DistilBERT base con una testa di classificazione per sequenze. La sequenza di classificazione head è uno strato lineare sopra gli output ragruppati.",n,p,v,z,C="Riutilizza facilmente questo checkpoint per un’altra attività passando ad un model head differente. Per un attività di risposta alle domande, utilizzerai il model head <code>DistilBertForQuestionAnswering</code>. La head per compiti di question answering è simile alla classificazione di sequenza head tranne per il fatto che è uno strato lineare sopra l’output degli stati nascosti (hidden states in inglese)",k,M,w;return p=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),M=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZyUwQSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),{c(){l=u("p"),l.innerHTML=m,n=r(),f(p.$$.fragment),v=r(),z=u("p"),z.innerHTML=C,k=r(),f(M.$$.fragment)},l(c){l=d(c,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1u5umc5"&&(l.innerHTML=m),n=o(c),g(p.$$.fragment,c),v=o(c),z=d(c,"P",{"data-svelte-h":!0}),j(z)!=="svelte-3acy4z"&&(z.innerHTML=C),k=o(c),g(M.$$.fragment,c)},m(c,_){a(c,l,_),a(c,n,_),$(p,c,_),a(c,v,_),a(c,z,_),a(c,k,_),$(M,c,_),w=!0},p:Y,i(c){w||(h(p.$$.fragment,c),h(M.$$.fragment,c),w=!0)},o(c){b(p.$$.fragment,c),b(M.$$.fragment,c),w=!1},d(c){c&&(s(l),s(n),s(v),s(z),s(k)),y(p,c),y(M,c)}}}function vs(Z){let l,m;return l=new Jt({props:{$$slots:{default:[js]},$$scope:{ctx:Z}}}),{c(){f(l.$$.fragment)},l(n){g(l.$$.fragment,n)},m(n,p){$(l,n,p),m=!0},p(n,p){const v={};p&2&&(v.$$scope={dirty:p,ctx:n}),l.$set(v)},i(n){m||(h(l.$$.fragment,n),m=!0)},o(n){b(l.$$.fragment,n),m=!1},d(n){y(l,n)}}}function zs(Z){let l,m="Per esempio, <code>TFDistilBertForSequenceClassification</code> è un modello DistilBERT base con classificazione di sequenza head. La classificazione di sequenza head è uno strato lineare sopra gli output raggruppati.",n,p,v,z,C="Riutilizza facilmente questo checkpoint per un altra attività passando ad un modello head diverso. Per un attività di risposta alle domande, utilizzerai il model head <code>TFDistilBertForQuestionAnswering</code>. Il head di risposta alle domande è simile alla sequenza di classificazione head tranne per il fatto che è uno strato lineare sopra l’output degli stati nascosti (hidden states in inglese)",k,M,w;return p=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0Zl9tb2RlbCUyMCUzRCUyMFRGRGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),M=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBdGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),{c(){l=u("p"),l.innerHTML=m,n=r(),f(p.$$.fragment),v=r(),z=u("p"),z.innerHTML=C,k=r(),f(M.$$.fragment)},l(c){l=d(c,"P",{"data-svelte-h":!0}),j(l)!=="svelte-12mkr0g"&&(l.innerHTML=m),n=o(c),g(p.$$.fragment,c),v=o(c),z=d(c,"P",{"data-svelte-h":!0}),j(z)!=="svelte-1gxw94o"&&(z.innerHTML=C),k=o(c),g(M.$$.fragment,c)},m(c,_){a(c,l,_),a(c,n,_),$(p,c,_),a(c,v,_),a(c,z,_),a(c,k,_),$(M,c,_),w=!0},p:Y,i(c){w||(h(p.$$.fragment,c),h(M.$$.fragment,c),w=!0)},o(c){b(p.$$.fragment,c),b(M.$$.fragment,c),w=!1},d(c){c&&(s(l),s(n),s(v),s(z),s(k)),y(p,c),y(M,c)}}}function Ms(Z){let l,m;return l=new Jt({props:{$$slots:{default:[zs]},$$scope:{ctx:Z}}}),{c(){f(l.$$.fragment)},l(n){g(l.$$.fragment,n)},m(n,p){$(l,n,p),m=!0},p(n,p){const v={};p&2&&(v.$$scope={dirty:p,ctx:n}),l.$set(v)},i(n){m||(h(l.$$.fragment,n),m=!0)},o(n){b(l.$$.fragment,n),m=!1},d(n){y(l,n)}}}function _s(Z){let l,m='Non tutti i modelli supportano un tokenizer veloce. Dai un’occhiata a questo <a href="index#supported-frameworks">tabella</a> per verificare se un modello ha il supporto per tokenizer veloce.';return{c(){l=u("p"),l.innerHTML=m},l(n){l=d(n,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1jbik8k"&&(l.innerHTML=m)},m(n,p){a(n,l,p)},p:Y,d(n){n&&s(l)}}}function Ts(Z){let l,m="Per l’impostazione predefinita, <code>AutoTokenizer</code> proverà a caricare un tokenizer veloce. Puoi disabilitare questo comportamento impostando <code>use_fast=False</code> in <code>from_pretrained</code>.";return{c(){l=u("p"),l.innerHTML=m},l(n){l=d(n,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1ar4vf4"&&(l.innerHTML=m)},m(n,p){a(n,l,p)},p:Y,d(n){n&&s(l)}}}function Zs(Z){let l,m="Se non stai cercando alcuna personalizzazione, usa il metodo <code>from_pretrained</code> per caricare i parametri di default dell’estrattore di caratteristiche di un modello.";return{c(){l=u("p"),l.innerHTML=m},l(n){l=d(n,"P",{"data-svelte-h":!0}),j(l)!=="svelte-10hto70"&&(l.innerHTML=m)},m(n,p){a(n,l,p)},p:Y,d(n){n&&s(l)}}}function qs(Z){let l,m,n,p,v,z,C,k='Una <a href="model_doc/auto"><code>AutoClass</code></a> deduce automaticamente il modello dell’architettura e scarica la configurazione e i pesi pre-allenati. Generalmente, noi consigliamo di usare un <code>AutoClass</code> per produrre un codice indipendente dal checkpoint. Ma gli utenti che desiderano un controllo maggiore su parametri specifici del modello possono creare un modello 🤗 Transformers personalizzato da poche classi base. Questo potrebbe essere particolarmente utile per qualunque persona sia interessata nel studiare, allenare o sperimentare con un modello 🤗 Transformers. In questa guida, approfondisci la creazione di un modello personalizzato senza <code>AutoClass</code>. Impara come:',M,w,c="<li>Caricare e personalizzare una configurazione del modello.</li> <li>Creare un’architettura modello.</li> <li>Creare un tokenizer lento e veloce per il testo.</li> <li>Creare un estrattore di caratteristiche per attività riguardanti audio o immagini.</li> <li>Creare un processore per attività multimodali.</li>",_,W,J,U,G='Una <a href="main_classes/configuration">configurazione</a> si riferisce agli attributi specifici di un modello. Ogni configurazione del modello ha attributi diversi; per esempio, tutti i modelli npl hanno questi attributi in comune <code>hidden_size</code>, <code>num_attention_heads</code>, <code>num_hidden_layers</code> e <code>vocab_size</code>. Questi attributi specificano il numero di attention heads o strati nascosti con cui costruire un modello.',R,V,i='Dai un’occhiata più da vicino a <a href="model_doc/distilbert">DistilBERT</a> accedendo a <code>DistilBertConfig</code> per ispezionare i suoi attributi:',T,L,Ve,Q,Rt="<code>DistilBertConfig</code> mostra tutti gli attributi predefiniti usati per costruire una base <code>DistilBertModel</code>. Tutti gli attributi sono personalizzabili, creando uno spazio per sperimentare. Per esempio, puoi configurare un modello predefinito per:",Ue,N,Ct="<li>Provare un funzione di attivazione diversa con il parametro <code>activation</code>.</li> <li>Utilizzare tasso di drop out più elevato per le probalità di attention con il parametro <code>attention_dropout</code>.</li>",Ge,I,xe,P,Wt="Nella funzione <code>from_pretrained()</code> possono essere modificati gli attributi del modello pre-allenato:",Xe,D,Fe,S,Vt="Quando la configurazione del modello ti soddisfa, la puoi salvare con <code>save_pretrained()</code>. Il file della tua configurazione è memorizzato come file JSON nella save directory specificata:",He,A,Ee,K,Ut="Per riutilizzare la configurazione del file, caricalo con <code>from_pretrained()</code>:",Be,O,Ye,x,Le,ee,Qe,te,Gt='Il prossimo passo e di creare <a href="main_classes/models">modello</a>. Il modello - vagamente riferito anche come architettura - definisce cosa ogni strato deve fare e quali operazioni stanno succedendo. Attributi come <code>num_hidden_layers</code> provenienti dalla configurazione sono usati per definire l’architettura. Ogni modello condivide la classe base <code>PreTrainedModel</code> e alcuni metodi comuni come il ridimensionamento degli input embeddings e la soppressione delle self-attention heads . Inoltre, tutti i modelli sono la sottoclasse di <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html" rel="nofollow"><code>torch.nn.Module</code></a>, <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow"><code>tf.keras.Model</code></a> o <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow"><code>flax.linen.Module</code></a>. Cio significa che i modelli sono compatibili con l’uso di ciascun di framework.',Ne,X,Ie,se,Pe,ae,xt="A questo punto, hai un modello DistilBERT base i cui output sono gli <em>hidden states</em> (in italiano stati nascosti). Gli stati nascosti sono passati come input a un model head per produrre l’output finale. 🤗 Transformers fornisce un model head diverso per ogni attività fintanto che il modello supporta l’attività  (i.e., non puoi usare DistilBERT per un attività sequence-to-sequence come la traduzione).",De,F,Se,le,Ae,ne,Xt='L’ultima classe base di cui hai bisogno prima di utilizzare un modello per i dati testuali è un <a href="main_classes/tokenizer">tokenizer</a> per convertire il testo grezzo in tensori. Ci sono due tipi di tokenizer che puoi usare con 🤗 Transformers:',Ke,ie,Ft='<li><code>PreTrainedTokenizer</code>: un’implementazione Python di un tokenizer.</li> <li><code>PreTrainedTokenizerFast</code>: un tokenizer dalla nostra libreria <a href="https://huggingface.co/docs/tokenizers/python/latest/" rel="nofollow">🤗 Tokenizer</a> basata su Rust. Questo tipo di tokenizer è significativamente più veloce, specialmente durante la batch tokenization, grazie alla sua implementazione Rust. Il tokenizer veloce offre anche metodi aggiuntivi come <em>offset mapping</em> che associa i token alle loro parole o caratteri originali.</li>',Oe,re,Ht="Entrambi i tokenizer supportano metodi comuni come la codifica e la decodifica, l’aggiunta di nuovi token e la gestione di token speciali.",et,H,tt,oe,Et="Se hai addestrato il tuo tokenizer, puoi crearne uno dal tuo file <em>vocabolario</em>:",st,pe,at,ce,Bt="È importante ricordare che il vocabolario di un tokenizer personalizzato sarà diverso dal vocabolario generato dal tokenizer di un modello preallenato. È necessario utilizzare il vocabolario di un modello preallenato se si utilizza un modello preallenato, altrimenti gli input non avranno senso. Crea un tokenizer con il vocabolario di un modello preallenato con la classe <code>DistilBertTokenizer</code>:",lt,me,nt,ue,Yt="Crea un tokenizer veloce con la classe <code>DistilBertTokenizerFast</code>:",it,de,rt,E,ot,fe,pt,ge,Lt="Un estrattore di caratteristiche (feature in inglese) elabora input audio o immagini. Eredita dalla classe <code>FeatureExtractionMixin</code> base e può anche ereditare dalla classe <code>ImageFeatureExtractionMixin</code> per l’elaborazione delle caratteristiche dell’immagine o dalla classe <code>SequenceFeatureExtractor</code> per l’elaborazione degli input audio.",ct,$e,Qt='A seconda che tu stia lavorando a un’attività audio o visiva, crea un estrattore di caratteristiche associato al modello che stai utilizzando. Ad esempio, crea un <code>ViTFeatureExtractor</code> predefinito se stai usando <a href="model_doc/vit">ViT</a> per la classificazione delle immagini:',mt,he,ut,B,dt,be,Nt="Modifica uno qualsiasi dei parametri <code>ViTFeatureExtractor</code> per creare il tuo estrattore di caratteristiche personalizzato:",ft,ye,gt,je,It="Per gli input audio, puoi creare un <code>Wav2Vec2FeatureExtractor</code> e personalizzare i parametri in modo simile:",$t,ve,ht,ze,bt,Me,Pt="Per modelli che supportano attività multimodali, 🤗 Transformers offre una classe di processore che racchiude comodamente un estrattore di caratteristiche e un tokenizer in un unico oggetto. Ad esempio, utilizziamo <code>Wav2Vec2Processor</code> per un’attività di riconoscimento vocale automatico (ASR). ASR trascrive l’audio in testo, quindi avrai bisogno di un estrattore di caratteristiche e di un tokenizer.",yt,_e,Dt="Crea un estrattore di feature per gestire gli input audio:",jt,Te,vt,Ze,St="Crea un tokenizer per gestire gli input di testo:",zt,qe,Mt,we,At="Combinare l’estrattore di caratteristiche e il tokenizer in <code>Wav2Vec2Processor</code>:",_t,ke,Tt,Je,Kt="Con due classi di base - configurazione e modello - e una classe di preelaborazione aggiuntiva (tokenizer, estrattore di caratteristiche o processore), puoi creare qualsiasi modello supportato da 🤗 Transformers. Ognuna di queste classi base è configurabile, consentendoti di utilizzare gli attributi specifici che desideri. È possibile impostare facilmente un modello per l’addestramento o modificare un modello preallenato esistente per la messa a punto.",Zt,Re,qt,We,wt;return v=new Ce({props:{title:"Crea un’architettura personalizzata",local:"crea-unarchitettura-personalizzata",headingTag:"h1"}}),W=new Ce({props:{title:"Configurazione",local:"configurazione",headingTag:"h2"}}),L=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRDb25maWclMEElMEFjb25maWclMjAlM0QlMjBEaXN0aWxCZXJ0Q29uZmlnKCklMEFwcmludChjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>config = DistilBertConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;gelu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`,wrap:!1}}),I=new q({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZyhhY3RpdmF0aW9uJTNEJTIycmVsdSUyMiUyQyUyMGF0dGVudGlvbl9kcm9wb3V0JTNEMC40KSUwQXByaW50KG15X2NvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig(activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;relu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.4</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`,wrap:!1}}),D=new q({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyJTJDJTIwYWN0aXZhdGlvbiUzRCUyMnJlbHUlMjIlMkMlMjBhdHRlbnRpb25fZHJvcG91dCUzRDAuNCk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)',wrap:!1}}),A=new q({props:{code:"bXlfY29uZmlnLnNhdmVfcHJldHJhaW5lZChzYXZlX2RpcmVjdG9yeSUzRCUyMi4lMkZ5b3VyX21vZGVsX3NhdmVfcGF0aCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config.save_pretrained(save_directory=<span class="hljs-string">&quot;./your_model_save_path&quot;</span>)',wrap:!1}}),O=new q({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnlvdXJfbW9kZWxfc2F2ZV9wYXRoJTJGbXlfY29uZmlnLmpzb24lMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/my_config.json&quot;</span>)',wrap:!1}}),x=new kt({props:{$$slots:{default:[gs]},$$scope:{ctx:Z}}}),ee=new Ce({props:{title:"Modello",local:"modello",headingTag:"h2"}}),X=new rs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ys],pytorch:[hs]},$$scope:{ctx:Z}}}),se=new Ce({props:{title:"Model head",local:"model-head",headingTag:"h3"}}),F=new rs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ms],pytorch:[vs]},$$scope:{ctx:Z}}}),le=new Ce({props:{title:"Tokenizer",local:"tokenizer",headingTag:"h2"}}),H=new kt({props:{warning:!0,$$slots:{default:[_s]},$$scope:{ctx:Z}}}),pe=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXIlMEElMEFteV90b2tlbml6ZXIlMjAlM0QlMjBEaXN0aWxCZXJ0VG9rZW5pemVyKHZvY2FiX2ZpbGUlM0QlMjJteV92b2NhYl9maWxlLnR4dCUyMiUyQyUyMGRvX2xvd2VyX2Nhc2UlM0RGYWxzZSUyQyUyMHBhZGRpbmdfc2lkZSUzRCUyMmxlZnQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>my_tokenizer = DistilBertTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>, do_lower_case=<span class="hljs-literal">False</span>, padding_side=<span class="hljs-string">&quot;left&quot;</span>)`,wrap:!1}}),me=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXIlMEElMEFzbG93X3Rva2VuaXplciUyMCUzRCUyMERpc3RpbEJlcnRUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>slow_tokenizer = DistilBertTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),de=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXJGYXN0JTBBJTBBZmFzdF90b2tlbml6ZXIlMjAlM0QlMjBEaXN0aWxCZXJ0VG9rZW5pemVyRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>fast_tokenizer = DistilBertTokenizerFast.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),E=new kt({props:{$$slots:{default:[Ts]},$$scope:{ctx:Z}}}),fe=new Ce({props:{title:"Estrattore Di Feature",local:"estrattore-di-feature",headingTag:"h2"}}),he=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEZlYXR1cmVFeHRyYWN0b3IlMEElMEF2aXRfZXh0cmFjdG9yJTIwJTNEJTIwVmlURmVhdHVyZUV4dHJhY3RvcigpJTBBcHJpbnQodml0X2V4dHJhY3Rvcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTFeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>vit_extractor = ViTFeatureExtractor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(vit_extractor)
ViTFeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;ViTFeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-number">2</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`,wrap:!1}}),B=new kt({props:{$$slots:{default:[Zs]},$$scope:{ctx:Z}}}),ye=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEZlYXR1cmVFeHRyYWN0b3IlMEElMEFteV92aXRfZXh0cmFjdG9yJTIwJTNEJTIwVmlURmVhdHVyZUV4dHJhY3RvcihyZXNhbXBsZSUzRCUyMlBJTC5JbWFnZS5CT1glMjIlMkMlMjBkb19ub3JtYWxpemUlM0RGYWxzZSUyQyUyMGltYWdlX21lYW4lM0QlNUIwLjMlMkMlMjAwLjMlMkMlMjAwLjMlNUQpJTBBcHJpbnQobXlfdml0X2V4dHJhY3Rvcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTFeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>my_vit_extractor = ViTFeatureExtractor(resample=<span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>, do_normalize=<span class="hljs-literal">False</span>, image_mean=[<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_vit_extractor)
ViTFeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: false,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;ViTFeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`,wrap:!1}}),ve=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3RvciUwQSUwQXcydjJfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKCklMEFwcmludCh3MnYyX2V4dHJhY3Rvcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>w2v2_extractor = Wav2Vec2FeatureExtractor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(w2v2_extractor)
Wav2Vec2FeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;Wav2Vec2FeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;feature_size&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;padding_side&quot;</span>: <span class="hljs-string">&quot;right&quot;</span>,
  <span class="hljs-string">&quot;padding_value&quot;</span>: <span class="hljs-number">0.0</span>,
  <span class="hljs-string">&quot;return_attention_mask&quot;</span>: false,
  <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">16000</span>
}`,wrap:!1}}),ze=new Ce({props:{title:"Processore",local:"processore",headingTag:"h2"}}),Te=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3RvciUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKHBhZGRpbmdfdmFsdWUlM0QxLjAlMkMlMjBkb19ub3JtYWxpemUlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = Wav2Vec2FeatureExtractor(padding_value=<span class="hljs-number">1.0</span>, do_normalize=<span class="hljs-literal">True</span>)`,wrap:!1}}),qe=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyQ1RDVG9rZW5pemVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwV2F2MlZlYzJDVENUb2tlbml6ZXIodm9jYWJfZmlsZSUzRCUyMm15X3ZvY2FiX2ZpbGUudHh0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2CTCTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Wav2Vec2CTCTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>)`,wrap:!1}}),ke=new q({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyUHJvY2Vzc29yJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwV2F2MlZlYzJQcm9jZXNzb3IoZmVhdHVyZV9leHRyYWN0b3IlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUyMHRva2VuaXplciUzRHRva2VuaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2Processor

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)`,wrap:!1}}),Re=new fs({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/it/create_a_model.md"}}),{c(){l=u("meta"),m=r(),n=u("p"),p=r(),f(v.$$.fragment),z=r(),C=u("p"),C.innerHTML=k,M=r(),w=u("ul"),w.innerHTML=c,_=r(),f(W.$$.fragment),J=r(),U=u("p"),U.innerHTML=G,R=r(),V=u("p"),V.innerHTML=i,T=r(),f(L.$$.fragment),Ve=r(),Q=u("p"),Q.innerHTML=Rt,Ue=r(),N=u("ul"),N.innerHTML=Ct,Ge=r(),f(I.$$.fragment),xe=r(),P=u("p"),P.innerHTML=Wt,Xe=r(),f(D.$$.fragment),Fe=r(),S=u("p"),S.innerHTML=Vt,He=r(),f(A.$$.fragment),Ee=r(),K=u("p"),K.innerHTML=Ut,Be=r(),f(O.$$.fragment),Ye=r(),f(x.$$.fragment),Le=r(),f(ee.$$.fragment),Qe=r(),te=u("p"),te.innerHTML=Gt,Ne=r(),f(X.$$.fragment),Ie=r(),f(se.$$.fragment),Pe=r(),ae=u("p"),ae.innerHTML=xt,De=r(),f(F.$$.fragment),Se=r(),f(le.$$.fragment),Ae=r(),ne=u("p"),ne.innerHTML=Xt,Ke=r(),ie=u("ul"),ie.innerHTML=Ft,Oe=r(),re=u("p"),re.textContent=Ht,et=r(),f(H.$$.fragment),tt=r(),oe=u("p"),oe.innerHTML=Et,st=r(),f(pe.$$.fragment),at=r(),ce=u("p"),ce.innerHTML=Bt,lt=r(),f(me.$$.fragment),nt=r(),ue=u("p"),ue.innerHTML=Yt,it=r(),f(de.$$.fragment),rt=r(),f(E.$$.fragment),ot=r(),f(fe.$$.fragment),pt=r(),ge=u("p"),ge.innerHTML=Lt,ct=r(),$e=u("p"),$e.innerHTML=Qt,mt=r(),f(he.$$.fragment),ut=r(),f(B.$$.fragment),dt=r(),be=u("p"),be.innerHTML=Nt,ft=r(),f(ye.$$.fragment),gt=r(),je=u("p"),je.innerHTML=It,$t=r(),f(ve.$$.fragment),ht=r(),f(ze.$$.fragment),bt=r(),Me=u("p"),Me.innerHTML=Pt,yt=r(),_e=u("p"),_e.textContent=Dt,jt=r(),f(Te.$$.fragment),vt=r(),Ze=u("p"),Ze.textContent=St,zt=r(),f(qe.$$.fragment),Mt=r(),we=u("p"),we.innerHTML=At,_t=r(),f(ke.$$.fragment),Tt=r(),Je=u("p"),Je.textContent=Kt,Zt=r(),f(Re.$$.fragment),qt=r(),We=u("p"),this.h()},l(e){const t=us("svelte-u9bgzb",document.head);l=d(t,"META",{name:!0,content:!0}),t.forEach(s),m=o(e),n=d(e,"P",{}),ns(n).forEach(s),p=o(e),g(v.$$.fragment,e),z=o(e),C=d(e,"P",{"data-svelte-h":!0}),j(C)!=="svelte-1pk49vt"&&(C.innerHTML=k),M=o(e),w=d(e,"UL",{"data-svelte-h":!0}),j(w)!=="svelte-1i4pxwa"&&(w.innerHTML=c),_=o(e),g(W.$$.fragment,e),J=o(e),U=d(e,"P",{"data-svelte-h":!0}),j(U)!=="svelte-1g7k4fs"&&(U.innerHTML=G),R=o(e),V=d(e,"P",{"data-svelte-h":!0}),j(V)!=="svelte-zjobm7"&&(V.innerHTML=i),T=o(e),g(L.$$.fragment,e),Ve=o(e),Q=d(e,"P",{"data-svelte-h":!0}),j(Q)!=="svelte-1nu4if9"&&(Q.innerHTML=Rt),Ue=o(e),N=d(e,"UL",{"data-svelte-h":!0}),j(N)!=="svelte-timpd0"&&(N.innerHTML=Ct),Ge=o(e),g(I.$$.fragment,e),xe=o(e),P=d(e,"P",{"data-svelte-h":!0}),j(P)!=="svelte-1vxy6m3"&&(P.innerHTML=Wt),Xe=o(e),g(D.$$.fragment,e),Fe=o(e),S=d(e,"P",{"data-svelte-h":!0}),j(S)!=="svelte-rceoh2"&&(S.innerHTML=Vt),He=o(e),g(A.$$.fragment,e),Ee=o(e),K=d(e,"P",{"data-svelte-h":!0}),j(K)!=="svelte-10zc6fb"&&(K.innerHTML=Ut),Be=o(e),g(O.$$.fragment,e),Ye=o(e),g(x.$$.fragment,e),Le=o(e),g(ee.$$.fragment,e),Qe=o(e),te=d(e,"P",{"data-svelte-h":!0}),j(te)!=="svelte-1p5e5z3"&&(te.innerHTML=Gt),Ne=o(e),g(X.$$.fragment,e),Ie=o(e),g(se.$$.fragment,e),Pe=o(e),ae=d(e,"P",{"data-svelte-h":!0}),j(ae)!=="svelte-1ir6m4o"&&(ae.innerHTML=xt),De=o(e),g(F.$$.fragment,e),Se=o(e),g(le.$$.fragment,e),Ae=o(e),ne=d(e,"P",{"data-svelte-h":!0}),j(ne)!=="svelte-u9n0xn"&&(ne.innerHTML=Xt),Ke=o(e),ie=d(e,"UL",{"data-svelte-h":!0}),j(ie)!=="svelte-1bupnko"&&(ie.innerHTML=Ft),Oe=o(e),re=d(e,"P",{"data-svelte-h":!0}),j(re)!=="svelte-10hgx86"&&(re.textContent=Ht),et=o(e),g(H.$$.fragment,e),tt=o(e),oe=d(e,"P",{"data-svelte-h":!0}),j(oe)!=="svelte-19yqkad"&&(oe.innerHTML=Et),st=o(e),g(pe.$$.fragment,e),at=o(e),ce=d(e,"P",{"data-svelte-h":!0}),j(ce)!=="svelte-tgkt2x"&&(ce.innerHTML=Bt),lt=o(e),g(me.$$.fragment,e),nt=o(e),ue=d(e,"P",{"data-svelte-h":!0}),j(ue)!=="svelte-cd6sn7"&&(ue.innerHTML=Yt),it=o(e),g(de.$$.fragment,e),rt=o(e),g(E.$$.fragment,e),ot=o(e),g(fe.$$.fragment,e),pt=o(e),ge=d(e,"P",{"data-svelte-h":!0}),j(ge)!=="svelte-1wdma6m"&&(ge.innerHTML=Lt),ct=o(e),$e=d(e,"P",{"data-svelte-h":!0}),j($e)!=="svelte-172gwou"&&($e.innerHTML=Qt),mt=o(e),g(he.$$.fragment,e),ut=o(e),g(B.$$.fragment,e),dt=o(e),be=d(e,"P",{"data-svelte-h":!0}),j(be)!=="svelte-s82mgl"&&(be.innerHTML=Nt),ft=o(e),g(ye.$$.fragment,e),gt=o(e),je=d(e,"P",{"data-svelte-h":!0}),j(je)!=="svelte-10s4a3d"&&(je.innerHTML=It),$t=o(e),g(ve.$$.fragment,e),ht=o(e),g(ze.$$.fragment,e),bt=o(e),Me=d(e,"P",{"data-svelte-h":!0}),j(Me)!=="svelte-eo5266"&&(Me.innerHTML=Pt),yt=o(e),_e=d(e,"P",{"data-svelte-h":!0}),j(_e)!=="svelte-s1q7lo"&&(_e.textContent=Dt),jt=o(e),g(Te.$$.fragment,e),vt=o(e),Ze=d(e,"P",{"data-svelte-h":!0}),j(Ze)!=="svelte-14d8if5"&&(Ze.textContent=St),zt=o(e),g(qe.$$.fragment,e),Mt=o(e),we=d(e,"P",{"data-svelte-h":!0}),j(we)!=="svelte-bpecop"&&(we.innerHTML=At),_t=o(e),g(ke.$$.fragment,e),Tt=o(e),Je=d(e,"P",{"data-svelte-h":!0}),j(Je)!=="svelte-13i7cen"&&(Je.textContent=Kt),Zt=o(e),g(Re.$$.fragment,e),qt=o(e),We=d(e,"P",{}),ns(We).forEach(s),this.h()},h(){is(l,"name","hf:doc:metadata"),is(l,"content",ws)},m(e,t){ds(document.head,l),a(e,m,t),a(e,n,t),a(e,p,t),$(v,e,t),a(e,z,t),a(e,C,t),a(e,M,t),a(e,w,t),a(e,_,t),$(W,e,t),a(e,J,t),a(e,U,t),a(e,R,t),a(e,V,t),a(e,T,t),$(L,e,t),a(e,Ve,t),a(e,Q,t),a(e,Ue,t),a(e,N,t),a(e,Ge,t),$(I,e,t),a(e,xe,t),a(e,P,t),a(e,Xe,t),$(D,e,t),a(e,Fe,t),a(e,S,t),a(e,He,t),$(A,e,t),a(e,Ee,t),a(e,K,t),a(e,Be,t),$(O,e,t),a(e,Ye,t),$(x,e,t),a(e,Le,t),$(ee,e,t),a(e,Qe,t),a(e,te,t),a(e,Ne,t),$(X,e,t),a(e,Ie,t),$(se,e,t),a(e,Pe,t),a(e,ae,t),a(e,De,t),$(F,e,t),a(e,Se,t),$(le,e,t),a(e,Ae,t),a(e,ne,t),a(e,Ke,t),a(e,ie,t),a(e,Oe,t),a(e,re,t),a(e,et,t),$(H,e,t),a(e,tt,t),a(e,oe,t),a(e,st,t),$(pe,e,t),a(e,at,t),a(e,ce,t),a(e,lt,t),$(me,e,t),a(e,nt,t),a(e,ue,t),a(e,it,t),$(de,e,t),a(e,rt,t),$(E,e,t),a(e,ot,t),$(fe,e,t),a(e,pt,t),a(e,ge,t),a(e,ct,t),a(e,$e,t),a(e,mt,t),$(he,e,t),a(e,ut,t),$(B,e,t),a(e,dt,t),a(e,be,t),a(e,ft,t),$(ye,e,t),a(e,gt,t),a(e,je,t),a(e,$t,t),$(ve,e,t),a(e,ht,t),$(ze,e,t),a(e,bt,t),a(e,Me,t),a(e,yt,t),a(e,_e,t),a(e,jt,t),$(Te,e,t),a(e,vt,t),a(e,Ze,t),a(e,zt,t),$(qe,e,t),a(e,Mt,t),a(e,we,t),a(e,_t,t),$(ke,e,t),a(e,Tt,t),a(e,Je,t),a(e,Zt,t),$(Re,e,t),a(e,qt,t),a(e,We,t),wt=!0},p(e,[t]){const Ot={};t&2&&(Ot.$$scope={dirty:t,ctx:e}),x.$set(Ot);const es={};t&2&&(es.$$scope={dirty:t,ctx:e}),X.$set(es);const ts={};t&2&&(ts.$$scope={dirty:t,ctx:e}),F.$set(ts);const ss={};t&2&&(ss.$$scope={dirty:t,ctx:e}),H.$set(ss);const as={};t&2&&(as.$$scope={dirty:t,ctx:e}),E.$set(as);const ls={};t&2&&(ls.$$scope={dirty:t,ctx:e}),B.$set(ls)},i(e){wt||(h(v.$$.fragment,e),h(W.$$.fragment,e),h(L.$$.fragment,e),h(I.$$.fragment,e),h(D.$$.fragment,e),h(A.$$.fragment,e),h(O.$$.fragment,e),h(x.$$.fragment,e),h(ee.$$.fragment,e),h(X.$$.fragment,e),h(se.$$.fragment,e),h(F.$$.fragment,e),h(le.$$.fragment,e),h(H.$$.fragment,e),h(pe.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(E.$$.fragment,e),h(fe.$$.fragment,e),h(he.$$.fragment,e),h(B.$$.fragment,e),h(ye.$$.fragment,e),h(ve.$$.fragment,e),h(ze.$$.fragment,e),h(Te.$$.fragment,e),h(qe.$$.fragment,e),h(ke.$$.fragment,e),h(Re.$$.fragment,e),wt=!0)},o(e){b(v.$$.fragment,e),b(W.$$.fragment,e),b(L.$$.fragment,e),b(I.$$.fragment,e),b(D.$$.fragment,e),b(A.$$.fragment,e),b(O.$$.fragment,e),b(x.$$.fragment,e),b(ee.$$.fragment,e),b(X.$$.fragment,e),b(se.$$.fragment,e),b(F.$$.fragment,e),b(le.$$.fragment,e),b(H.$$.fragment,e),b(pe.$$.fragment,e),b(me.$$.fragment,e),b(de.$$.fragment,e),b(E.$$.fragment,e),b(fe.$$.fragment,e),b(he.$$.fragment,e),b(B.$$.fragment,e),b(ye.$$.fragment,e),b(ve.$$.fragment,e),b(ze.$$.fragment,e),b(Te.$$.fragment,e),b(qe.$$.fragment,e),b(ke.$$.fragment,e),b(Re.$$.fragment,e),wt=!1},d(e){e&&(s(m),s(n),s(p),s(z),s(C),s(M),s(w),s(_),s(J),s(U),s(R),s(V),s(T),s(Ve),s(Q),s(Ue),s(N),s(Ge),s(xe),s(P),s(Xe),s(Fe),s(S),s(He),s(Ee),s(K),s(Be),s(Ye),s(Le),s(Qe),s(te),s(Ne),s(Ie),s(Pe),s(ae),s(De),s(Se),s(Ae),s(ne),s(Ke),s(ie),s(Oe),s(re),s(et),s(tt),s(oe),s(st),s(at),s(ce),s(lt),s(nt),s(ue),s(it),s(rt),s(ot),s(pt),s(ge),s(ct),s($e),s(mt),s(ut),s(dt),s(be),s(ft),s(gt),s(je),s($t),s(ht),s(bt),s(Me),s(yt),s(_e),s(jt),s(vt),s(Ze),s(zt),s(Mt),s(we),s(_t),s(Tt),s(Je),s(Zt),s(qt),s(We)),s(l),y(v,e),y(W,e),y(L,e),y(I,e),y(D,e),y(A,e),y(O,e),y(x,e),y(ee,e),y(X,e),y(se,e),y(F,e),y(le,e),y(H,e),y(pe,e),y(me,e),y(de,e),y(E,e),y(fe,e),y(he,e),y(B,e),y(ye,e),y(ve,e),y(ze,e),y(Te,e),y(qe,e),y(ke,e),y(Re,e)}}}const ws='{"title":"Crea un’architettura personalizzata","local":"crea-unarchitettura-personalizzata","sections":[{"title":"Configurazione","local":"configurazione","sections":[],"depth":2},{"title":"Modello","local":"modello","sections":[{"title":"Model head","local":"model-head","sections":[],"depth":3}],"depth":2},{"title":"Tokenizer","local":"tokenizer","sections":[],"depth":2},{"title":"Estrattore Di Feature","local":"estrattore-di-feature","sections":[],"depth":2},{"title":"Processore","local":"processore","sections":[],"depth":2}],"depth":1}';function ks(Z){return ps(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gs extends cs{constructor(l){super(),ms(this,l,ks,qs,os,{})}}export{Gs as component};
