import{s as _r,o as Zr,n as ve}from"../chunks/scheduler.36a0863c.js";import{S as kr,i as Wr,g as s,s as o,u as h,A as Ir,h as a,f as t,c as i,j as m,v as f,y as r,k as u,o as d,a as n,w as M,d as y,t as g,x as v}from"../chunks/index.d0f7a4c4.js";import{T as Fl}from"../chunks/Tip.4c7d7eb1.js";import{I as J}from"../chunks/IconCopyLink.bc5fad79.js";import{C as T}from"../chunks/CodeBlock.4236768d.js";import{F as Nr,M as xr}from"../chunks/Markdown.2bf44d4a.js";function Ar($){let p,w,c,j=`Una volta salvato il checkpoint, possiamo esportarlo su ONNX puntando l’argomento <code>--model</code>
del pacchetto <code>transformers.onnx</code> nella directory desiderata:`,C,U,z;return p=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBJTIzJTIwTG9hZCUyMHRva2VuaXplciUyMGFuZCUyMFB5VG9yY2glMjB3ZWlnaHRzJTIwZm9ybSUyMHRoZSUyMEh1YiUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQXB0X21vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTIzJTIwU2F2ZSUyMHRvJTIwZGlzayUwQXRva2VuaXplci5zYXZlX3ByZXRyYWluZWQoJTIybG9jYWwtcHQtY2hlY2twb2ludCUyMiklMEFwdF9tb2RlbC5zYXZlX3ByZXRyYWluZWQoJTIybG9jYWwtcHQtY2hlY2twb2ludCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load tokenizer and PyTorch weights form the Hub</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Save to disk</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.save_pretrained(<span class="hljs-string">&quot;local-pt-checkpoint&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pt_model.save_pretrained(<span class="hljs-string">&quot;local-pt-checkpoint&quot;</span>)`,wrap:!1}}),U=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0tbW9kZWwlM0Rsb2NhbC1wdC1jaGVja3BvaW50JTIwb25ueCUyRg==",highlighted:"python -m transformers.onnx --model=local-pt-checkpoint onnx/",wrap:!1}}),{c(){h(p.$$.fragment),w=o(),c=s("p"),c.innerHTML=j,C=o(),h(U.$$.fragment)},l(b){f(p.$$.fragment,b),w=i(b),c=a(b,"P",{"data-svelte-h":!0}),r(c)!=="svelte-1rjvspr"&&(c.innerHTML=j),C=i(b),f(U.$$.fragment,b)},m(b,x){M(p,b,x),n(b,w,x),n(b,c,x),n(b,C,x),M(U,b,x),z=!0},p:ve,i(b){z||(y(p.$$.fragment,b),y(U.$$.fragment,b),z=!0)},o(b){g(p.$$.fragment,b),g(U.$$.fragment,b),z=!1},d(b){b&&(t(w),t(c),t(C)),v(p,b),v(U,b)}}}function Br($){let p,w;return p=new xr({props:{$$slots:{default:[Ar]},$$scope:{ctx:$}}}),{c(){h(p.$$.fragment)},l(c){f(p.$$.fragment,c)},m(c,j){M(p,c,j),w=!0},p(c,j){const C={};j&2&&(C.$$scope={dirty:j,ctx:c}),p.$set(C)},i(c){w||(y(p.$$.fragment,c),w=!0)},o(c){g(p.$$.fragment,c),w=!1},d(c){v(p,c)}}}function Rr($){let p,w,c,j=`Once the checkpoint is saved, we can export it to ONNX by pointing the <code>--model</code>
argument of the <code>transformers.onnx</code> package to the desired directory:`,C,U,z;return p=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEElMjMlMjBMb2FkJTIwdG9rZW5pemVyJTIwYW5kJTIwVGVuc29yRmxvdyUyMHdlaWdodHMlMjBmcm9tJTIwdGhlJTIwSHViJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBdGZfbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQSUyMyUyMFNhdmUlMjB0byUyMGRpc2slMEF0b2tlbml6ZXIuc2F2ZV9wcmV0cmFpbmVkKCUyMmxvY2FsLXRmLWNoZWNrcG9pbnQlMjIpJTBBdGZfbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMmxvY2FsLXRmLWNoZWNrcG9pbnQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFAutoModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load tokenizer and TensorFlow weights from the Hub</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFAutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Save to disk</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.save_pretrained(<span class="hljs-string">&quot;local-tf-checkpoint&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model.save_pretrained(<span class="hljs-string">&quot;local-tf-checkpoint&quot;</span>)`,wrap:!1}}),U=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0tbW9kZWwlM0Rsb2NhbC10Zi1jaGVja3BvaW50JTIwb25ueCUyRg==",highlighted:"python -m transformers.onnx --model=local-tf-checkpoint onnx/",wrap:!1}}),{c(){h(p.$$.fragment),w=o(),c=s("p"),c.innerHTML=j,C=o(),h(U.$$.fragment)},l(b){f(p.$$.fragment,b),w=i(b),c=a(b,"P",{"data-svelte-h":!0}),r(c)!=="svelte-128pexq"&&(c.innerHTML=j),C=i(b),f(U.$$.fragment,b)},m(b,x){M(p,b,x),n(b,w,x),n(b,c,x),n(b,C,x),M(U,b,x),z=!0},p:ve,i(b){z||(y(p.$$.fragment,b),y(U.$$.fragment,b),z=!0)},o(b){g(p.$$.fragment,b),g(U.$$.fragment,b),z=!1},d(b){b&&(t(w),t(c),t(C)),v(p,b),v(U,b)}}}function Er($){let p,w;return p=new xr({props:{$$slots:{default:[Rr]},$$scope:{ctx:$}}}),{c(){h(p.$$.fragment)},l(c){f(p.$$.fragment,c)},m(c,j){M(p,c,j),w=!0},p(c,j){const C={};j&2&&(C.$$scope={dirty:j,ctx:c}),p.$set(C)},i(c){w||(y(p.$$.fragment,c),w=!0)},o(c){g(p.$$.fragment,c),w=!1},d(c){v(p,c)}}}function Xr($){let p,w=`Le caratteristiche che hanno un suffisso <code>wtih-past</code> (ad es. <code>causal-lm-with-past</code>)
corrispondono a topologie di modello con stati nascosti precalcolati (chiave e valori
nei blocchi di attenzione) che possono essere utilizzati per la decodifica autoregressiva veloce.`;return{c(){p=s("p"),p.innerHTML=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1on6rqr"&&(p.innerHTML=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Gr($){let p,w=`Un buon modo per implementare una configurazione ONNX personalizzata è guardare l’implementazione
esistente nel file <code>configuration_&lt;model_name&gt;.py</code> di un’architettura simile.`;return{c(){p=s("p"),p.innerHTML=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-k15enw"&&(p.innerHTML=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Hr($){let p,w=`Puoi notare che la proprietà <code>inputs</code> per <code>DistilBertOnnxConfig</code> restituisce un
<code>OrdinatoDict</code>. Ciò garantisce che gli input corrispondano alla loro posizione
relativa all’interno del metodo <code>PreTrainedModel.forward()</code> durante il tracciamento del grafico.
Raccomandiamo di usare un <code>OrderedDict</code> per le proprietà <code>inputs</code> e <code>outputs</code>
quando si implementano configurazioni ONNX personalizzate.`;return{c(){p=s("p"),p.innerHTML=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-9pdb1s"&&(p.innerHTML=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Vr($){let p,w=`Tutte le proprietà e i metodi di base associati a <code>OnnxConfig</code> e le
altre classi di configurazione possono essere sovrascritte se necessario. Guarda
<code>BartOnnxConfig</code> per un esempio avanzato.`;return{c(){p=s("p"),p.innerHTML=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-8je27i"&&(p.innerHTML=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Sr($){let p,w=`Se il tuo modello è più largo di 2 GB, vedrai che molti file aggiuntivi sono
creati durante l’esportazione. Questo è <em>previsto</em> perché ONNX utilizza <a href="https://developers.google.com/protocol-buffers/" rel="nofollow">Protocol
Buffer</a> per memorizzare il modello e
questi hanno un limite di dimensione 2 GB. Vedi la <a href="https://github.com/onnx/onnx/blob/master/docs/ExternalData.md" rel="nofollow">Documentazione
ONNX</a>
per istruzioni su come caricare modelli con dati esterni.`;return{c(){p=s("p"),p.innerHTML=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-zgeibt"&&(p.innerHTML=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Qr($){let p,w=`Questo è l’inizio dei nostri esperimenti con TorchScript e stiamo ancora esplorando le sue capacità con
modelli con variable-input-size. È una nostra priorità e approfondiremo le nostre analisi nelle prossime versioni,
con più esempi di codici, un’implementazione più flessibile e benchmark che confrontano i codici basati su Python con quelli compilati con
TorchScript.`;return{c(){p=s("p"),p.textContent=w},l(c){p=a(c,"P",{"data-svelte-h":!0}),r(p)!=="svelte-1puyypy"&&(p.textContent=w)},m(c,j){n(c,p,j)},p:ve,d(c){c&&t(p)}}}function Lr($){let p,w,c,j,C,U,z,b,x,zl,mo="Esporta modelli 🤗 Transformers",gn,be,ho=`Se devi implementare 🤗 modelli Transformers in ambienti di produzione, noi
consigliamo di esportarli in un formato serializzato che può essere caricato ed eseguito
su runtime e hardware specializzati. In questa guida ti mostreremo come farlo
esporta 🤗 Modelli Transformers in due formati ampiamente utilizzati: ONNX e TorchScript.`,vn,we,fo=`Una volta esportato, un modello può essere ottimizato per l’inferenza tramite tecniche come
la quantizzazione e soppressione. Se sei interessato a ottimizzare i tuoi modelli per l’esecuzione
con la massima efficienza, dai un’occhiata a <a href="https://github.com/huggingface/optimum" rel="nofollow">🤗 Optimum
library</a>.`,bn,_,q,ql,je,qa,xl,Mo="ONNX",wn,Te,yo=`Il progetto <a href="http://onnx.ai" rel="nofollow">ONNX (Open Neural Network eXchange)</a> Il progetto onnx è un open
standard che definisce un insieme comune di operatori e un formato di file comune a
rappresentano modelli di deep learning in un’ampia varietà di framework, tra cui
PyTorch e TensorFlow. Quando un modello viene esportato nel formato ONNX, questi
operatori sono usati per costruire un grafico computazionale (often called an
<em>intermediate representation</em>) che rappresenta il flusso di dati attraverso la
rete neurale.`,jn,Ce,go=`Esponendo un grafico con operatori e tipi di dati standardizzati, ONNX rende
più facile passare da un framework all’altro. Ad esempio, un modello allenato in PyTorch può
essere esportato in formato ONNX e quindi importato in TensorFlow (e viceversa).`,Tn,Ue,vo=`🤗 Transformers fornisce un pacchetto <code>transformers.onnx</code> che ti consente di
convertire i checkpoint del modello in un grafico ONNX sfruttando gli oggetti di configurazione.
Questi oggetti di configurazione sono già pronti per una serie di architetture di modelli,
e sono progettati per essere facilmente estensibili ad altre architetture.`,Cn,$e,bo="Le configurazioni pronte includono le seguenti architetture:",Un,Je,wo="<li>ALBERT</li> <li>BART</li> <li>BEiT</li> <li>BERT</li> <li>BigBird</li> <li>BigBird-Pegasus</li> <li>Blenderbot</li> <li>BlenderbotSmall</li> <li>CamemBERT</li> <li>ConvBERT</li> <li>Data2VecText</li> <li>Data2VecVision</li> <li>DeiT</li> <li>DistilBERT</li> <li>ELECTRA</li> <li>FlauBERT</li> <li>GPT Neo</li> <li>GPT-J</li> <li>I-BERT</li> <li>LayoutLM</li> <li>M2M100</li> <li>Marian</li> <li>mBART</li> <li>MobileBERT</li> <li>OpenAI GPT-2</li> <li>Perceiver</li> <li>PLBart</li> <li>RoBERTa</li> <li>RoFormer</li> <li>SqueezeBERT</li> <li>T5</li> <li>ViT</li> <li>XLM</li> <li>XLM-RoBERTa</li> <li>XLM-RoBERTa-XL</li>",$n,ze,jo="Nelle prossime due sezioni, ti mostreremo come:",Jn,xe,To="<li>Esporta un modello supportato usando il pacchetto <code>transformers.onnx</code>.</li> <li>Esporta un modello personalizzato per un’architettura non supportata.</li>",zn,Z,P,Pl,_e,Pa,_l,Co="Esportazione di un modello in ONNX",xn,Ze,Uo=`Per esportare un modello 🤗 Transformers in ONNX, dovrai prima installarne alcune
dipendenze extra:`,_n,ke,Zn,We,$o="Il pacchetto <code>transformers.onnx</code> può essere usato come modulo Python:",kn,Ie,Wn,Ne,Jo="L’esportazione di un checkpoint utilizzando una configurazione già pronta può essere eseguita come segue:",In,Ae,Nn,Be,zo="che dovrebbe mostrare i seguenti log:",An,Re,Bn,Ee,xo=`Questo esporta un grafico ONNX del checkpoint definito dall’argomento <code>--model</code>.
In questo esempio è <code>distilbert-base-uncased</code>, ma può essere qualsiasi checkpoint
Hugging Face Hub o uno memorizzato localmente.`,Rn,Xe,_o=`Il file risultante <code>model.onnx</code> può quindi essere eseguito su uno dei <a href="https://onnx.ai/supported-tools.html#deployModel" rel="nofollow">tanti
acceleratori</a> che supportano il
lo standard ONNX. Ad esempio, possiamo caricare ed eseguire il modello con <a href="https://onnxruntime.ai/" rel="nofollow">ONNX
Runtime</a> come segue:`,En,Ge,Xn,He,Zo=`I nomi di output richiesti (cioè <code>[&quot;last_hidden_state&quot;]</code>) possono essere ottenuti
dando un’occhiata alla configurazione ONNX di ogni modello. Ad esempio, per
DistilBERT abbiamo:`,Gn,Ve,Hn,Se,ko=`Il processo è identico per i checkpoint TensorFlow sull’hub. Ad esempio, noi
possiamo esportare un checkpoint TensorFlow puro da <a href="https://huggingface.co/keras-io" rel="nofollow">Keras
organizzazione</a> come segue:`,Vn,Qe,Sn,Le,Wo=`Per esportare un modello memorizzato localmente, devi disporre dei pesi del modello
e file tokenizer memorizzati in una directory. Ad esempio, possiamo caricare e salvare un
checkpoint come segue:`,Qn,Y,Ln,k,O,Yl,Fe,Ya,Zl,Io="Selezione delle caratteristiche per diverse topologie di modello",Fn,qe,No=`Ogni configurazione già pronta viene fornita con una serie di <em>caratteristiche</em> che ti consentono di
esportare modelli per diversi tipi di topologie o attività. Come mostrato nella tabella
di seguito, ogni caratteristica è associata a una diversa Auto Class:`,qn,Pe,Ao="<thead><tr><th>Caratteristica</th> <th>Auto Class</th></tr></thead> <tbody><tr><td><code>causal-lm</code>, <code>causal-lm-with-past</code></td> <td><code>AutoModelForCausalLM</code></td></tr> <tr><td><code>default</code>, <code>default-with-past</code></td> <td><code>AutoModel</code></td></tr> <tr><td><code>masked-lm</code></td> <td><code>AutoModelForMaskedLM</code></td></tr> <tr><td><code>question-answering</code></td> <td><code>AutoModelForQuestionAnswering</code></td></tr> <tr><td><code>seq2seq-lm</code>, <code>seq2seq-lm-with-past</code></td> <td><code>AutoModelForSeq2SeqLM</code></td></tr> <tr><td><code>sequence-classification</code></td> <td><code>AutoModelForSequenceClassification</code></td></tr> <tr><td><code>token-classification</code></td> <td><code>AutoModelForTokenClassification</code></td></tr></tbody>",Pn,Ye,Bo=`Per ciascuna configurazione, puoi trovare l’elenco delle funzionalità supportate tramite il
<code>FeaturesManager</code>. Ad esempio, per DistilBERT abbiamo:`,Yn,Oe,On,De,Ro=`Puoi quindi passare una di queste funzionalità all’argomento <code>--feature</code> nel
pacchetto <code>transformers.onnx</code>. Ad esempio, per esportare un modello di classificazione del testo
possiamo scegliere un modello ottimizzato dall’Hub ed eseguire:`,Dn,Ke,Kn,et,Eo="che visualizzerà i seguenti registri:",es,tt,ts,lt,Xo=`Puoi notare che in questo caso, i nomi di output del modello ottimizzato sono
<code>logits</code> invece di <code>last_hidden_state</code> che abbiamo visto con il
checkpoint <code>distilbert-base-uncased</code> precedente. Questo è previsto dal
modello ottimizato visto che ha una testa di e.`,ls,D,ns,W,K,Ol,nt,Oa,kl,Go="Esportazione di un modello per un'architettura non supportata",ss,st,Ho=`Se desideri esportare un modello la cui architettura non è nativamente supportata dalla
libreria, ci sono tre passaggi principali da seguire:`,as,at,Vo="<li>Implementare una configurazione ONNX personalizzata.</li> <li>Esportare il modello in ONNX.</li> <li>Convalidare gli output di PyTorch e dei modelli esportati.</li>",os,ot,So=`In questa sezione, vedremo come DistilBERT è stato implementato per mostrare cosa è
coinvolto in ogni passaggio.`,is,I,ee,Dl,it,Da,Wl,Qo="Implementazione di una configurazione ONNX personalizzata",rs,rt,Lo=`Iniziamo con l’oggetto di configurazione ONNX. Forniamo tre classi
astratte da cui ereditare, a seconda del tipo di archittettura
del modello che desideri esportare:`,ps,pt,Fo="<li>I modelli basati su encoder ereditano da <code>OnnxConfig</code></li> <li>I modelli basati su decoder ereditano da <code>OnnxConfigWithPast</code></li> <li>I modelli encoder-decoder ereditano da<code>OnnxSeq2SeqConfigWithPast</code></li>",cs,te,us,ct,qo=`Poiché DistilBERT è un modello basato su encoder, la sua configurazione eredita da
<code>OnnxConfig</code>:`,ds,ut,ms,dt,Po=`Ogni oggetto di configurazione deve implementare la proprietà <code>inputs</code> e restituire una
mappatura, dove ogni chiave corrisponde a un input previsto e ogni valore
indica l’asse di quell’input. Per DistilBERT, possiamo vedere che sono richiesti
due input: <code>input_ids</code> e <code>attention_mask</code>. Questi inputs hanno la stessa forma di
<code>(batch_size, sequence_length)</code> per questo motivo vediamo gli stessi assi usati nella
configurazione.`,hs,le,fs,mt,Yo=`Dopo aver implementato una configurazione ONNX, è possibile istanziarla
fornendo alla configurazione del modello base come segue:`,Ms,ht,ys,ft,Oo=`L’oggetto risultante ha diverse proprietà utili. Ad esempio è possibile visualizzare il
Set operatore ONNX che verrà utilizzato durante l’esportazione:`,gs,Mt,vs,yt,Do="È inoltre possibile visualizzare gli output associati al modello come segue:",bs,gt,ws,vt,Ko=`Puoi notare che la proprietà degli output segue la stessa struttura degli input; esso
restituisce un <code>OrderedDict</code> di output con nome e le loro forme. La struttura di output
è legato alla scelta della funzione con cui viene inizializzata la configurazione.
Per impostazione predefinita, la configurazione ONNX viene inizializzata con la funzione ‘predefinita’
che corrisponde all’esportazione di un modello caricato con la classe <code>AutoModel</code>. Se tu
desideri esportare una topologia di modello diversa, è sufficiente fornire una funzionalità diversa a
l’argomento <code>task</code> quando inizializzi la configurazione ONNX. Ad esempio, se
volevamo esportare DistilBERT con una testa di classificazione per sequenze, potremmo
usare:`,js,bt,Ts,ne,Cs,N,se,Kl,wt,Ka,Il,ei="Esportazione del modello",Us,jt,ti=`Una volta implementata la configurazione ONNX, il passaggio successivo consiste nell’esportare il
modello. Qui possiamo usare la funzione <code>export()</code> fornita dal
pacchetto <code>transformers.onnx</code>. Questa funzione prevede la configurazione ONNX, insieme
con il modello base e il tokenizer e il percorso per salvare il file esportato:`,$s,Tt,Js,Ct,li=`Gli <code>onnx_inputs</code> e <code>onnx_outputs</code> restituiti dalla funzione <code>export()</code> sono
liste di chiavi definite nelle proprietà di <code>input</code> e <code>output</code> della
configurazione. Una volta esportato il modello, puoi verificare che il modello sia ben
formato come segue:`,zs,Ut,xs,ae,_s,A,oe,en,$t,eo,Nl,ni="Convalida degli output del modello",Zs,Jt,si=`Il passaggio finale consiste nel convalidare gli output dal modello di base e quello esportato
corrispondere entro una soglia di tolleranza assoluta. Qui possiamo usare la
Funzione <code>validate_model_outputs()</code> fornita dal pacchetto <code>transformers.onnx</code>
come segue:`,ks,zt,Ws,xt,ai=`Questa funzione usa il metodo <code>OnnxConfig.generate_dummy_inputs()</code> per generare
input per il modello di base e quello esportato e la tolleranza assoluta può essere
definita nella configurazione. Generalmente troviamo una corrispondenza numerica nell’intervallo da 1e-6
a 1e-4, anche se è probabile che qualsiasi cosa inferiore a 1e-3 vada bene.`,Is,B,ie,tn,_t,to,Al,oi="Contribuire con una nuova configurazione a 🤗 Transformers",Ns,Zt,ii=`Stiamo cercando di espandere l’insieme di configurazioni già pronte e di accettare
contributi della community! Se vuoi contribuire con la tua aggiunta
nella libreria, dovrai:`,As,kt,ri="<li>Implementare la configurazione ONNX nella corrispondente <code>configuration file _&lt;model_name&gt;.py</code></li> <li>Includere l’architettura del modello e le funzioni corrispondenti in <code>~onnx.features.FeatureManager</code></li> <li>Aggiungere la tua architettura del modello ai test in <code>test_onnx_v2.py</code></li>",Bs,Wt,pi=`Scopri come stato contribuito la configurazione per [IBERT]
(<a href="https://github.com/huggingface/transformers/pull/14868/files" rel="nofollow">https://github.com/huggingface/transformers/pull/14868/files</a>) per
avere un’idea di cosa è coinvolto.`,Rs,R,re,ln,It,lo,Bl,ci="TorchScript",Es,pe,Xs,Nt,ui=`Secondo la documentazione di Pytorch: “TorchScript è un modo per creare modelli serializzabili e ottimizzabili da codice
Pytorch”. I due moduli di Pytorch <a href="https://pytorch.org/docs/stable/jit.html" rel="nofollow">JIT e TRACE</a> consentono allo sviluppatore di esportare
il loro modello da riutilizzare in altri programmi, come i programmi C++ orientati all’efficienza.`,Gs,At,di=`Abbiamo fornito un’interfaccia che consente l’esportazione di modelli 🤗 Transformers in TorchScript in modo che possano essere riutilizzati
in un ambiente diverso rispetto a un programma Python basato su Pytorch. Qui spieghiamo come esportare e utilizzare i nostri modelli utilizzando
TorchScript.`,Hs,Bt,mi="Esportare un modello richiede due cose:",Vs,Rt,hi="<li>Un passaggio in avanti con input fittizzi.</li> <li>Istanziazione del modello con flag <code>torchscript</code>.</li>",Ss,Et,fi="Queste necessità implicano diverse cose a cui gli sviluppatori dovrebbero prestare attenzione. Questi dettagli mostrati sotto.",Qs,E,ce,nn,Xt,no,Rl,Mi="Flag TorchScript e pesi legati",Ls,Gt,yi=`Questo flag è necessario perché la maggior parte dei modelli linguistici in questo repository hanno pesi legati tra il loro
strato “Embedding” e lo strato “Decoding”. TorchScript non consente l’esportazione di modelli che hanno pesi
legati, quindi è necessario prima slegare e clonare i pesi.`,Fs,Ht,gi=`Ciò implica che i modelli istanziati con il flag <code>torchscript</code> hanno il loro strato <code>Embedding</code> e strato <code>Decoding</code>
separato, il che significa che non dovrebbero essere addestrati in futuro. L’allenamento de-sincronizza i due
strati, portando a risultati inaspettati.`,qs,Vt,vi=`Questo non è il caso per i modelli che non hanno una testa del modello linguistico, poiché quelli non hanno pesi legati. Questi modelli
può essere esportato in sicurezza senza il flag <code>torchscript</code>.`,Ps,X,ue,sn,St,so,El,bi="Input fittizi e standard lengths",Ys,Qt,wi=`Gli input fittizzi sono usati per fare un modello passaggio in avanti . Mentre i valori degli input si propagano attraverso i strati,
Pytorch tiene traccia delle diverse operazioni eseguite su ciascun tensore. Queste operazioni registrate vengono quindi utilizzate per
creare la “traccia” del modello.`,Os,Lt,ji=`La traccia viene creata relativamente alle dimensioni degli input. È quindi vincolato dalle dimensioni dell’input
fittizio e non funzionerà per altre lunghezze di sequenza o dimensioni batch. Quando si proverà con una dimensione diversa, ci sarà errore
come:`,Ds,Ft,Ti="<code>La dimensione espansa del tensore (3) deve corrispondere alla dimensione esistente (7) nella dimensione non singleton 2</code>",Ks,qt,Ci=`will be raised. Si consiglia pertanto di tracciare il modello con una dimensione di input fittizia grande almeno quanto il più grande
input che verrà fornito al modello durante l’inferenza. È possibile eseguire il padding per riempire i valori mancanti. Il modello
sarà tracciato con una grande dimensione di input, tuttavia, anche le dimensioni della diverse matrici saranno grandi,
risultando in più calcoli.`,ea,Pt,Ui=`Si raccomanda di prestare attenzione al numero totale di operazioni eseguite su ciascun input e di seguire da vicino le prestazioni
durante l’esportazione di modelli di sequenza-lunghezza variabili.`,ta,G,de,an,Yt,ao,Xl,$i="Usare TorchSscript in Python",la,Ot,Ji="Di seguito è riportato un esempio, che mostra come salvare, caricare modelli e come utilizzare la traccia per l’inferenza.",na,H,me,on,Dt,oo,Gl,zi="Salvare un modello",sa,Kt,xi=`Questo frammento di codice mostra come usare TorchScript per esportare un <code>BertModel</code>. Qui il <code>BertModel</code> è istanziato secondo
una classe <code>BertConfig</code> e quindi salvato su disco con il nome del file <code>traced_bert.pt</code>`,aa,el,oa,V,he,rn,tl,io,Hl,_i="Caricare un modello",ia,ll,Zi=`Questo frammento di codice mostra come caricare il <code>BertModel</code> che era stato precedentemente salvato su disco con il nome <code>traced_bert.pt</code>.
Stiamo riutilizzando il <code>dummy_input</code> precedentemente inizializzato.`,ra,nl,pa,S,fe,pn,sl,ro,Vl,ki="Utilizzare un modello tracciato per l'inferenza",ca,al,Wi="Usare il modello tracciato per l’inferenza è semplice come usare il suo metodo dunder <code>__call__</code>:",ua,ol,da,il,Ii="###Implementare modelli HuggingFace TorchScript su AWS utilizzando Neuron SDK",ma,rl,Ni=`AWS ha introdotto <a href="https://aws.amazon.com/ec2/instance-types/inf1/" rel="nofollow">Amazon EC2 Inf1</a>
famiglia di istanze per l’inferenza di machine learning a basso costo e ad alte prestazioni nel cloud.
Le istanze Inf1 sono alimentate dal chip AWS Inferentia, un acceleratore hardware personalizzato,
specializzato in carichi di lavoro di inferenza di deep learning.
<a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#" rel="nofollow">AWS Neuron</a>
è l’SDK per Inferentia che supporta il tracciamento e l’ottimizzazione dei modelli transformers per
distribuzione su Inf1. L’SDK Neuron fornisce:`,ha,pl,Ai=`<li>API di facile utilizzo con una riga di modifica del codice per tracciare e ottimizzare un modello TorchScript per l’inferenza nel cloud.</li> <li>Ottimizzazioni delle prestazioni pronte all’uso per <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/%3E" rel="nofollow">miglioramento dei costi-prestazioni</a></li> <li>Supporto per i modelli di trasformatori HuggingFace costruiti con <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html" rel="nofollow">PyTorch</a>
o <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html" rel="nofollow">TensorFlow</a>.</li>`,fa,Q,Me,cn,cl,po,Sl,Bi="Implicazioni",Ma,ul,Ri=`Modelli Transformers basati su architettura <a href="https://huggingface.co/docs/transformers/main/model_doc/bert" rel="nofollow">BERT (Bidirectional Encoder Representations from Transformers)</a>,
o sue varianti come <a href="https://huggingface.co/docs/transformers/main/model_doc/distilbert" rel="nofollow">distilBERT</a>
e <a href="https://huggingface.co/docs/transformers/main/model_doc/roberta" rel="nofollow">roBERTa</a>
funzioneranno meglio su Inf1 per attività non generative come la question answering estrattive,
Classificazione della sequenza, Classificazione dei token. In alternativa, generazione di testo
le attività possono essere adattate per essere eseguite su Inf1, secondo questo <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html" rel="nofollow">tutorial AWS Neuron MarianMT</a>.
Ulteriori informazioni sui modelli che possono essere convertiti fuori dagli schemi su Inferentia possono essere
trovati nella <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia" rel="nofollow">sezione Model Architecture Fit della documentazione Neuron</a>.`,ya,L,ye,un,dl,co,Ql,Ei="Dipendenze",ga,ml,Xi="L’utilizzo di AWS Neuron per convertire i modelli richiede le seguenti dipendenze e l’ambiente:",va,hl,Gi=`<li>A <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide" rel="nofollow">Neuron SDK environment</a>,
which comes pre-configured on <a href="https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html" rel="nofollow">AWS Deep Learning AMI</a>.</li>`,ba,F,ge,dn,fl,uo,Ll,Hi="Convertire un modello per AWS Neuron",wa,Ml,Vi=`Usando lo stesso script come in <a href="https://huggingface.co/docs/transformers/main/en/serialization#using-torchscript-in-python" rel="nofollow">Usando TorchScipt in Python</a>
per tracciare un “BertModel”, importi l’estensione del framework <code>torch.neuron</code> per accedere
i componenti di Neuron SDK tramite un’API Python.`,ja,yl,Ta,gl,Si="E modificare solo la riga di codice di traccia",Ca,vl,Qi="Da:",Ua,bl,$a,wl,Li="A:",Ja,jl,za,Tl,Fi="Questa modifica consente a Neuron SDK di tracciare il modello e ottimizzarlo per l’esecuzione nelle istanze Inf1.",xa,Cl,qi=`Per ulteriori informazioni sulle funzionalità, gli strumenti, i tutorial di esempi e gli ultimi aggiornamenti di AWS Neuron SDK,
consultare la <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html" rel="nofollow">documentazione AWS NeuronSDK</a>.`,_a,mn,Za;return b=new J({}),je=new J({}),_e=new J({}),ke=new T({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyU1Qm9ubnglNUQ=",highlighted:"pip install transformers[onnx]",wrap:!1}}),Ie=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0taGVscCUwQSUwQXVzYWdlJTNBJTIwSHVnZ2luZyUyMEZhY2UlMjBUcmFuc2Zvcm1lcnMlMjBPTk5YJTIwZXhwb3J0ZXIlMjAlNUItaCU1RCUyMC1tJTIwTU9ERUwlMjAlNUItLWZlYXR1cmUlMjAlN0JjYXVzYWwtbG0lMkMlMjAuLi4lN0QlNUQlMjAlNUItLW9wc2V0JTIwT1BTRVQlNUQlMjAlNUItLWF0b2wlMjBBVE9MJTVEJTIwb3V0cHV0JTBBJTBBcG9zaXRpb25hbCUyMGFyZ3VtZW50cyUzQSUwQSUyMCUyMG91dHB1dCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMFBhdGglMjBpbmRpY2F0aW5nJTIwd2hlcmUlMjB0byUyMHN0b3JlJTIwZ2VuZXJhdGVkJTIwT05OWCUyMG1vZGVsLiUwQSUwQW9wdGlvbmFsJTIwYXJndW1lbnRzJTNBJTBBJTIwJTIwLWglMkMlMjAtLWhlbHAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzaG93JTIwdGhpcyUyMGhlbHAlMjBtZXNzYWdlJTIwYW5kJTIwZXhpdCUwQSUyMCUyMC1tJTIwTU9ERUwlMkMlMjAtLW1vZGVsJTIwTU9ERUwlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBNb2RlbCUyMElEJTIwb24lMjBodWdnaW5nZmFjZS5jbyUyMG9yJTIwcGF0aCUyMG9uJTIwZGlzayUyMHRvJTIwbG9hZCUyMG1vZGVsJTIwZnJvbS4lMEElMjAlMjAtLWZlYXR1cmUlMjAlN0JjYXVzYWwtbG0lMkMlMjAuLi4lN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBUaGUlMjB0eXBlJTIwb2YlMjBmZWF0dXJlcyUyMHRvJTIwZXhwb3J0JTIwdGhlJTIwbW9kZWwlMjB3aXRoLiUwQSUyMCUyMC0tb3BzZXQlMjBPUFNFVCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyME9OTlglMjBvcHNldCUyMHZlcnNpb24lMjB0byUyMGV4cG9ydCUyMHRoZSUyMG1vZGVsJTIwd2l0aC4lMEElMjAlMjAtLWF0b2wlMjBBVE9MJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwQWJzb2x1dGUlMjBkaWZmZXJlbmNlJTIwdG9sZXJhbmNlJTIwd2hlbiUyMHZhbGlkYXRpbmclMjB0aGUlMjBtb2RlbC4=",highlighted:`python -m transformers.onnx --<span class="hljs-built_in">help</span>

usage: Hugging Face Transformers ONNX exporter [-h] -m MODEL [--feature {causal-lm, ...}] [--opset OPSET] [--atol ATOL] output

positional arguments:
  output                Path indicating <span class="hljs-built_in">where</span> to store generated ONNX model.

optional arguments:
  -h, --<span class="hljs-built_in">help</span>            show this <span class="hljs-built_in">help</span> message and <span class="hljs-built_in">exit</span>
  -m MODEL, --model MODEL
                        Model ID on huggingface.co or path on disk to load model from.
  --feature {causal-lm, ...}
                        The <span class="hljs-built_in">type</span> of features to <span class="hljs-built_in">export</span> the model with.
  --opset OPSET         ONNX opset version to <span class="hljs-built_in">export</span> the model with.
  --atol ATOL           Absolute difference tolerance when validating the model.`,wrap:!1}}),Ae=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0tbW9kZWwlM0RkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMG9ubnglMkY=",highlighted:"python -m transformers.onnx --model=distilbert-base-uncased onnx/",wrap:!1}}),Re=new T({props:{code:"VmFsaWRhdGluZyUyME9OTlglMjBtb2RlbC4uLiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lNUIlRTIlOUMlOTMlNUQlMjBPTk5YJTIwbW9kZWwlMjBvdXRwdXQlMjBuYW1lcyUyMG1hdGNoJTIwcmVmZXJlbmNlJTIwbW9kZWwlMjAoJTdCJ2xhc3RfaGlkZGVuX3N0YXRlJyU3RCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtJTIwVmFsaWRhdGluZyUyME9OTlglMjBNb2RlbCUyMG91dHB1dCUyMCUyMmxhc3RfaGlkZGVuX3N0YXRlJTIyJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSU1QiVFMiU5QyU5MyU1RCUyMCgyJTJDJTIwOCUyQyUyMDc2OCklMjBtYXRjaGVzJTIwKDIlMkMlMjA4JTJDJTIwNzY4KSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lNUIlRTIlOUMlOTMlNUQlMjBhbGwlMjB2YWx1ZXMlMjBjbG9zZSUyMChhdG9sJTNBJTIwMWUtMDUpJTBBQWxsJTIwZ29vZCUyQyUyMG1vZGVsJTIwc2F2ZWQlMjBhdCUzQSUyMG9ubnglMkZtb2RlbC5vbm54",highlighted:`Validating ONNX model...
        -[✓] ONNX model output names match reference model ({<span class="hljs-string">&#x27;last_hidden_state&#x27;</span>})
        - Validating ONNX Model output <span class="hljs-string">&quot;last_hidden_state&quot;</span>:
                -[✓] (2, 8, 768) matches (2, 8, 768)
                -[✓] all values close (atol: 1e-05)
All good, model saved at: onnx/model.onnx`,wrap:!1}}),Ge=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEFmcm9tJTIwb25ueHJ1bnRpbWUlMjBpbXBvcnQlMjBJbmZlcmVuY2VTZXNzaW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBc2Vzc2lvbiUyMCUzRCUyMEluZmVyZW5jZVNlc3Npb24oJTIyb25ueCUyRm1vZGVsLm9ubnglMjIpJTBBJTIzJTIwT05OWCUyMFJ1bnRpbWUlMjBleHBlY3RzJTIwTnVtUHklMjBhcnJheXMlMjBhcyUyMGlucHV0JTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlVzaW5nJTIwRGlzdGlsQkVSVCUyMHdpdGglMjBPTk5YJTIwUnVudGltZSElMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMm5wJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBzZXNzaW9uLnJ1bihvdXRwdXRfbmFtZXMlM0QlNUIlMjJsYXN0X2hpZGRlbl9zdGF0ZSUyMiU1RCUyQyUyMGlucHV0X2ZlZWQlM0RkaWN0KGlucHV0cykp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> onnxruntime <span class="hljs-keyword">import</span> InferenceSession

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>session = InferenceSession(<span class="hljs-string">&quot;onnx/model.onnx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ONNX Runtime expects NumPy arrays as input</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Using DistilBERT with ONNX Runtime!&quot;</span>, return_tensors=<span class="hljs-string">&quot;np&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = session.run(output_names=[<span class="hljs-string">&quot;last_hidden_state&quot;</span>], input_feed=<span class="hljs-built_in">dict</span>(inputs))`,wrap:!1}}),Ve=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5tb2RlbHMuZGlzdGlsYmVydCUyMGltcG9ydCUyMERpc3RpbEJlcnRDb25maWclMkMlMjBEaXN0aWxCZXJ0T25ueENvbmZpZyUwQSUwQWNvbmZpZyUyMCUzRCUyMERpc3RpbEJlcnRDb25maWcoKSUwQW9ubnhfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydE9ubnhDb25maWcoY29uZmlnKSUwQXByaW50KGxpc3Qob25ueF9jb25maWcub3V0cHV0cy5rZXlzKCkpKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.models.distilbert <span class="hljs-keyword">import</span> DistilBertConfig, DistilBertOnnxConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>config = DistilBertConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_config = DistilBertOnnxConfig(config)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-built_in">list</span>(onnx_config.outputs.keys()))
[<span class="hljs-string">&quot;last_hidden_state&quot;</span>]`,wrap:!1}}),Qe=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0tbW9kZWwlM0RrZXJhcy1pbyUyRnRyYW5zZm9ybWVycy1xYSUyMG9ubnglMkY=",highlighted:"python -m transformers.onnx --model=keras-io/transformers-qa onnx/",wrap:!1}}),Y=new Nr({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Er],pytorch:[Br]},$$scope:{ctx:$}}}),Fe=new J({}),Oe=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5vbm54LmZlYXR1cmVzJTIwaW1wb3J0JTIwRmVhdHVyZXNNYW5hZ2VyJTBBJTBBZGlzdGlsYmVydF9mZWF0dXJlcyUyMCUzRCUyMGxpc3QoRmVhdHVyZXNNYW5hZ2VyLmdldF9zdXBwb3J0ZWRfZmVhdHVyZXNfZm9yX21vZGVsX3R5cGUoJTIyZGlzdGlsYmVydCUyMikua2V5cygpKSUwQXByaW50KGRpc3RpbGJlcnRfZmVhdHVyZXMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.onnx.features <span class="hljs-keyword">import</span> FeaturesManager

<span class="hljs-meta">&gt;&gt;&gt; </span>distilbert_features = <span class="hljs-built_in">list</span>(FeaturesManager.get_supported_features_for_model_type(<span class="hljs-string">&quot;distilbert&quot;</span>).keys())
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(distilbert_features)
[<span class="hljs-string">&quot;default&quot;</span>, <span class="hljs-string">&quot;masked-lm&quot;</span>, <span class="hljs-string">&quot;causal-lm&quot;</span>, <span class="hljs-string">&quot;sequence-classification&quot;</span>, <span class="hljs-string">&quot;token-classification&quot;</span>, <span class="hljs-string">&quot;question-answering&quot;</span>]`,wrap:!1}}),Ke=new T({props:{code:"cHl0aG9uJTIwLW0lMjB0cmFuc2Zvcm1lcnMub25ueCUyMC0tbW9kZWwlM0RkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0tZmVhdHVyZSUzRHNlcXVlbmNlLWNsYXNzaWZpY2F0aW9uJTIwb25ueCUyRg==",highlighted:`python -m transformers.onnx --model=distilbert-base-uncased-finetuned-sst-2-english \\
                            --feature=sequence-classification onnx/`,wrap:!1}}),tt=new T({props:{code:"VmFsaWRhdGluZyUyME9OTlglMjBtb2RlbC4uLiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lNUIlRTIlOUMlOTMlNUQlMjBPTk5YJTIwbW9kZWwlMjBvdXRwdXQlMjBuYW1lcyUyMG1hdGNoJTIwcmVmZXJlbmNlJTIwbW9kZWwlMjAoJTdCJ2xvZ2l0cyclN0QpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSUyMFZhbGlkYXRpbmclMjBPTk5YJTIwTW9kZWwlMjBvdXRwdXQlMjAlMjJsb2dpdHMlMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtJTVCJUUyJTlDJTkzJTVEJTIwKDIlMkMlMjAyKSUyMG1hdGNoZXMlMjAoMiUyQyUyMDIpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSU1QiVFMiU5QyU5MyU1RCUyMGFsbCUyMHZhbHVlcyUyMGNsb3NlJTIwKGF0b2wlM0ElMjAxZS0wNSklMEFBbGwlMjBnb29kJTJDJTIwbW9kZWwlMjBzYXZlZCUyMGF0JTNBJTIwb25ueCUyRm1vZGVsLm9ubng=",highlighted:`Validating ONNX model...
        -[✓] ONNX model output names match reference model ({<span class="hljs-string">&#x27;logits&#x27;</span>})
        - Validating ONNX Model output <span class="hljs-string">&quot;logits&quot;</span>:
                -[✓] (2, 2) matches (2, 2)
                -[✓] all values close (atol: 1e-05)
All good, model saved at: onnx/model.onnx`,wrap:!1}}),D=new Fl({props:{$$slots:{default:[Xr]},$$scope:{ctx:$}}}),nt=new J({}),it=new J({}),te=new Fl({props:{$$slots:{default:[Gr]},$$scope:{ctx:$}}}),ut=new T({props:{code:"ZnJvbSUyMHR5cGluZyUyMGltcG9ydCUyME1hcHBpbmclMkMlMjBPcmRlcmVkRGljdCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMub25ueCUyMGltcG9ydCUyME9ubnhDb25maWclMEElMEElMEFjbGFzcyUyMERpc3RpbEJlcnRPbm54Q29uZmlnKE9ubnhDb25maWcpJTNBJTBBJTIwJTIwJTIwJTIwJTQwcHJvcGVydHklMEElMjAlMjAlMjAlMjBkZWYlMjBpbnB1dHMoc2VsZiklMjAtJTNFJTIwTWFwcGluZyU1QnN0ciUyQyUyME1hcHBpbmclNUJpbnQlMkMlMjBzdHIlNUQlNUQlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBPcmRlcmVkRGljdCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAoJTIyaW5wdXRfaWRzJTIyJTJDJTIwJTdCMCUzQSUyMCUyMmJhdGNoJTIyJTJDJTIwMSUzQSUyMCUyMnNlcXVlbmNlJTIyJTdEKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCglMjJhdHRlbnRpb25fbWFzayUyMiUyQyUyMCU3QjAlM0ElMjAlMjJiYXRjaCUyMiUyQyUyMDElM0ElMjAlMjJzZXF1ZW5jZSUyMiU3RCklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> Mapping, OrderedDict
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.onnx <span class="hljs-keyword">import</span> OnnxConfig


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">DistilBertOnnxConfig</span>(<span class="hljs-title class_ inherited__">OnnxConfig</span>):
<span class="hljs-meta">... </span>    @<span class="hljs-built_in">property</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>) -&gt; Mapping[<span class="hljs-built_in">str</span>, Mapping[<span class="hljs-built_in">int</span>, <span class="hljs-built_in">str</span>]]:
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> OrderedDict(
<span class="hljs-meta">... </span>            [
<span class="hljs-meta">... </span>                (<span class="hljs-string">&quot;input_ids&quot;</span>, {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;batch&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;sequence&quot;</span>}),
<span class="hljs-meta">... </span>                (<span class="hljs-string">&quot;attention_mask&quot;</span>, {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;batch&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;sequence&quot;</span>}),
<span class="hljs-meta">... </span>            ]
<span class="hljs-meta">... </span>        )`,wrap:!1}}),le=new Fl({props:{$$slots:{default:[Hr]},$$scope:{ctx:$}}}),ht=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Db25maWclMEElMEFjb25maWclMjAlM0QlMjBBdXRvQ29uZmlnLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFvbm54X2NvbmZpZyUyMCUzRCUyMERpc3RpbEJlcnRPbm54Q29uZmlnKGNvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>config = AutoConfig.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_config = DistilBertOnnxConfig(config)`,wrap:!1}}),Mt=new T({props:{code:"cHJpbnQob25ueF9jb25maWcuZGVmYXVsdF9vbm54X29wc2V0KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(onnx_config.default_onnx_opset)
<span class="hljs-number">11</span>`,wrap:!1}}),gt=new T({props:{code:"cHJpbnQob25ueF9jb25maWcub3V0cHV0cyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(onnx_config.outputs)
OrderedDict([(<span class="hljs-string">&quot;last_hidden_state&quot;</span>, {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;batch&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;sequence&quot;</span>})])`,wrap:!1}}),bt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Db25maWclMEElMEFjb25maWclMjAlM0QlMjBBdXRvQ29uZmlnLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFvbm54X2NvbmZpZ19mb3Jfc2VxX2NsZiUyMCUzRCUyMERpc3RpbEJlcnRPbm54Q29uZmlnKGNvbmZpZyUyQyUyMHRhc2slM0QlMjJzZXF1ZW5jZS1jbGFzc2lmaWNhdGlvbiUyMiklMEFwcmludChvbm54X2NvbmZpZ19mb3Jfc2VxX2NsZi5vdXRwdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>config = AutoConfig.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_config_for_seq_clf = DistilBertOnnxConfig(config, task=<span class="hljs-string">&quot;sequence-classification&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(onnx_config_for_seq_clf.outputs)
OrderedDict([(<span class="hljs-string">&#x27;logits&#x27;</span>, {<span class="hljs-number">0</span>: <span class="hljs-string">&#x27;batch&#x27;</span>})])`,wrap:!1}}),ne=new Fl({props:{$$slots:{default:[Vr]},$$scope:{ctx:$}}}),wt=new J({}),Tt=new T({props:{code:"ZnJvbSUyMHBhdGhsaWIlMjBpbXBvcnQlMjBQYXRoJTBBZnJvbSUyMHRyYW5zZm9ybWVycy5vbm54JTIwaW1wb3J0JTIwZXhwb3J0JTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWwlMEElMEFvbm54X3BhdGglMjAlM0QlMjBQYXRoKCUyMm1vZGVsLm9ubnglMjIpJTBBbW9kZWxfY2twdCUyMCUzRCUyMCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyJTBBYmFzZV9tb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQobW9kZWxfY2twdCklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9ja3B0KSUwQSUwQW9ubnhfaW5wdXRzJTJDJTIwb25ueF9vdXRwdXRzJTIwJTNEJTIwZXhwb3J0KHRva2VuaXplciUyQyUyMGJhc2VfbW9kZWwlMkMlMjBvbm54X2NvbmZpZyUyQyUyMG9ubnhfY29uZmlnLmRlZmF1bHRfb25ueF9vcHNldCUyQyUyMG9ubnhfcGF0aCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> pathlib <span class="hljs-keyword">import</span> Path
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.onnx <span class="hljs-keyword">import</span> export
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel

<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_path = Path(<span class="hljs-string">&quot;model.onnx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model_ckpt = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>base_model = AutoModel.from_pretrained(model_ckpt)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_ckpt)

<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_inputs, onnx_outputs = export(tokenizer, base_model, onnx_config, onnx_config.default_onnx_opset, onnx_path)`,wrap:!1}}),Ut=new T({props:{code:"aW1wb3J0JTIwb25ueCUwQSUwQW9ubnhfbW9kZWwlMjAlM0QlMjBvbm54LmxvYWQoJTIybW9kZWwub25ueCUyMiklMEFvbm54LmNoZWNrZXIuY2hlY2tfbW9kZWwob25ueF9tb2RlbCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> onnx

<span class="hljs-meta">&gt;&gt;&gt; </span>onnx_model = onnx.load(<span class="hljs-string">&quot;model.onnx&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>onnx.checker.check_model(onnx_model)`,wrap:!1}}),ae=new Fl({props:{$$slots:{default:[Sr]},$$scope:{ctx:$}}}),$t=new J({}),zt=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5vbm54JTIwaW1wb3J0JTIwdmFsaWRhdGVfbW9kZWxfb3V0cHV0cyUwQSUwQXZhbGlkYXRlX21vZGVsX291dHB1dHMoJTBBJTIwJTIwJTIwJTIwb25ueF9jb25maWclMkMlMjB0b2tlbml6ZXIlMkMlMjBiYXNlX21vZGVsJTJDJTIwb25ueF9wYXRoJTJDJTIwb25ueF9vdXRwdXRzJTJDJTIwb25ueF9jb25maWcuYXRvbF9mb3JfdmFsaWRhdGlvbiUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.onnx <span class="hljs-keyword">import</span> validate_model_outputs

<span class="hljs-meta">&gt;&gt;&gt; </span>validate_model_outputs(
<span class="hljs-meta">... </span>    onnx_config, tokenizer, base_model, onnx_path, onnx_outputs, onnx_config.atol_for_validation
<span class="hljs-meta">... </span>)`,wrap:!1}}),_t=new J({}),It=new J({}),pe=new Fl({props:{$$slots:{default:[Qr]},$$scope:{ctx:$}}}),Xt=new J({}),St=new J({}),Yt=new J({}),Dt=new J({}),el=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRNb2RlbCUyQyUyMEJlcnRUb2tlbml6ZXIlMkMlMjBCZXJ0Q29uZmlnJTBBaW1wb3J0JTIwdG9yY2glMEElMEFlbmMlMjAlM0QlMjBCZXJ0VG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEElMjMlMjBUb2tlbml6aW5nJTIwaW5wdXQlMjB0ZXh0JTBBdGV4dCUyMCUzRCUyMCUyMiU1QkNMUyU1RCUyMFdobyUyMHdhcyUyMEppbSUyMEhlbnNvbiUyMCUzRiUyMCU1QlNFUCU1RCUyMEppbSUyMEhlbnNvbiUyMHdhcyUyMGElMjBwdXBwZXRlZXIlMjAlNUJTRVAlNUQlMjIlMEF0b2tlbml6ZWRfdGV4dCUyMCUzRCUyMGVuYy50b2tlbml6ZSh0ZXh0KSUwQSUwQSUyMyUyME1hc2tpbmclMjBvbmUlMjBvZiUyMHRoZSUyMGlucHV0JTIwdG9rZW5zJTBBbWFza2VkX2luZGV4JTIwJTNEJTIwOCUwQXRva2VuaXplZF90ZXh0JTVCbWFza2VkX2luZGV4JTVEJTIwJTNEJTIwJTIyJTVCTUFTSyU1RCUyMiUwQWluZGV4ZWRfdG9rZW5zJTIwJTNEJTIwZW5jLmNvbnZlcnRfdG9rZW5zX3RvX2lkcyh0b2tlbml6ZWRfdGV4dCklMEFzZWdtZW50c19pZHMlMjAlM0QlMjAlNUIwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSU1RCUwQSUwQSUyMyUyMENyZWF0aW5nJTIwYSUyMGR1bW15JTIwaW5wdXQlMEF0b2tlbnNfdGVuc29yJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QmluZGV4ZWRfdG9rZW5zJTVEKSUwQXNlZ21lbnRzX3RlbnNvcnMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCc2VnbWVudHNfaWRzJTVEKSUwQWR1bW15X2lucHV0JTIwJTNEJTIwJTVCdG9rZW5zX3RlbnNvciUyQyUyMHNlZ21lbnRzX3RlbnNvcnMlNUQlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjB0aGUlMjBtb2RlbCUyMHdpdGglMjB0aGUlMjB0b3JjaHNjcmlwdCUyMGZsYWclMEElMjMlMjBGbGFnJTIwc2V0JTIwdG8lMjBUcnVlJTIwZXZlbiUyMHRob3VnaCUyMGl0JTIwaXMlMjBub3QlMjBuZWNlc3NhcnklMjBhcyUyMHRoaXMlMjBtb2RlbCUyMGRvZXMlMjBub3QlMjBoYXZlJTIwYW4lMjBMTSUyMEhlYWQuJTBBY29uZmlnJTIwJTNEJTIwQmVydENvbmZpZyglMEElMjAlMjAlMjAlMjB2b2NhYl9zaXplX29yX2NvbmZpZ19qc29uX2ZpbGUlM0QzMjAwMCUyQyUwQSUyMCUyMCUyMCUyMGhpZGRlbl9zaXplJTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2hpZGRlbl9sYXllcnMlM0QxMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9hdHRlbnRpb25faGVhZHMlM0QxMiUyQyUwQSUyMCUyMCUyMCUyMGludGVybWVkaWF0ZV9zaXplJTNEMzA3MiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoc2NyaXB0JTNEVHJ1ZSUyQyUwQSklMEElMEElMjMlMjBJbnN0YW50aWF0aW5nJTIwdGhlJTIwbW9kZWwlMEFtb2RlbCUyMCUzRCUyMEJlcnRNb2RlbChjb25maWcpJTBBJTBBJTIzJTIwVGhlJTIwbW9kZWwlMjBuZWVkcyUyMHRvJTIwYmUlMjBpbiUyMGV2YWx1YXRpb24lMjBtb2RlJTBBbW9kZWwuZXZhbCgpJTBBJTBBJTIzJTIwSWYlMjB5b3UlMjBhcmUlMjBpbnN0YW50aWF0aW5nJTIwdGhlJTIwbW9kZWwlMjB3aXRoJTIwKmZyb21fcHJldHJhaW5lZColMjB5b3UlMjBjYW4lMjBhbHNvJTIwZWFzaWx5JTIwc2V0JTIwdGhlJTIwVG9yY2hTY3JpcHQlMjBmbGFnJTBBbW9kZWwlMjAlM0QlMjBCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyJTJDJTIwdG9yY2hzY3JpcHQlM0RUcnVlKSUwQSUwQSUyMyUyMENyZWF0aW5nJTIwdGhlJTIwdHJhY2UlMEF0cmFjZWRfbW9kZWwlMjAlM0QlMjB0b3JjaC5qaXQudHJhY2UobW9kZWwlMkMlMjAlNUJ0b2tlbnNfdGVuc29yJTJDJTIwc2VnbWVudHNfdGVuc29ycyU1RCklMEF0b3JjaC5qaXQuc2F2ZSh0cmFjZWRfbW9kZWwlMkMlMjAlMjJ0cmFjZWRfYmVydC5wdCUyMik=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertModel, BertTokenizer, BertConfig
<span class="hljs-keyword">import</span> torch

enc = BertTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-comment"># Tokenizing input text</span>
text = <span class="hljs-string">&quot;[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]&quot;</span>
tokenized_text = enc.tokenize(text)

<span class="hljs-comment"># Masking one of the input tokens</span>
masked_index = <span class="hljs-number">8</span>
tokenized_text[masked_index] = <span class="hljs-string">&quot;[MASK]&quot;</span>
indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
segments_ids = [<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">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-comment"># Creating a dummy input</span>
tokens_tensor = torch.tensor([indexed_tokens])
segments_tensors = torch.tensor([segments_ids])
dummy_input = [tokens_tensor, segments_tensors]

<span class="hljs-comment"># Initializing the model with the torchscript flag</span>
<span class="hljs-comment"># Flag set to True even though it is not necessary as this model does not have an LM Head.</span>
config = BertConfig(
    vocab_size_or_config_json_file=<span class="hljs-number">32000</span>,
    hidden_size=<span class="hljs-number">768</span>,
    num_hidden_layers=<span class="hljs-number">12</span>,
    num_attention_heads=<span class="hljs-number">12</span>,
    intermediate_size=<span class="hljs-number">3072</span>,
    torchscript=<span class="hljs-literal">True</span>,
)

<span class="hljs-comment"># Instantiating the model</span>
model = BertModel(config)

<span class="hljs-comment"># The model needs to be in evaluation mode</span>
model.<span class="hljs-built_in">eval</span>()

<span class="hljs-comment"># If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag</span>
model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, torchscript=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Creating the trace</span>
traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
torch.jit.save(traced_model, <span class="hljs-string">&quot;traced_bert.pt&quot;</span>)`,wrap:!1}}),tl=new J({}),nl=new T({props:{code:"bG9hZGVkX21vZGVsJTIwJTNEJTIwdG9yY2guaml0LmxvYWQoJTIydHJhY2VkX2JlcnQucHQlMjIpJTBBbG9hZGVkX21vZGVsLmV2YWwoKSUwQSUwQWFsbF9lbmNvZGVyX2xheWVycyUyQyUyMHBvb2xlZF9vdXRwdXQlMjAlM0QlMjBsb2FkZWRfbW9kZWwoKmR1bW15X2lucHV0KQ==",highlighted:`loaded_model = torch.jit.load(<span class="hljs-string">&quot;traced_bert.pt&quot;</span>)
loaded_model.<span class="hljs-built_in">eval</span>()

all_encoder_layers, pooled_output = loaded_model(*dummy_input)`,wrap:!1}}),sl=new J({}),ol=new T({props:{code:"dHJhY2VkX21vZGVsKHRva2Vuc190ZW5zb3IlMkMlMjBzZWdtZW50c190ZW5zb3JzKQ==",highlighted:"traced_model(tokens_tensor, segments_tensors)",wrap:!1}}),cl=new J({}),dl=new J({}),fl=new J({}),yl=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJlcnRNb2RlbCUyQyUyMEJlcnRUb2tlbml6ZXIlMkMlMjBCZXJ0Q29uZmlnJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjB0b3JjaC5uZXVyb24=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertModel, BertTokenizer, BertConfig
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> torch.neuron`,wrap:!1}}),bl=new T({props:{code:"dG9yY2guaml0LnRyYWNlKG1vZGVsJTJDJTIwJTVCdG9rZW5zX3RlbnNvciUyQyUyMHNlZ21lbnRzX3RlbnNvcnMlNUQp",highlighted:"torch.jit.trace(model, [tokens_tensor, segments_tensors])",wrap:!1}}),jl=new T({props:{code:"dG9yY2gubmV1cm9uLnRyYWNlKG1vZGVsJTJDJTIwJTVCdG9rZW5fdGVuc29yJTJDJTIwc2VnbWVudHNfdGVuc29ycyU1RCk=",highlighted:"torch.neuron.trace(model, [token_tensor, segments_tensors])",wrap:!1}}),{c(){p=s("meta"),w=o(),c=s("p"),j=o(),C=s("h1"),U=s("a"),z=s("span"),h(b.$$.fragment),x=o(),zl=s("span"),zl.textContent=mo,gn=o(),be=s("p"),be.textContent=ho,vn=o(),we=s("p"),we.innerHTML=fo,bn=o(),_=s("h2"),q=s("a"),ql=s("span"),h(je.$$.fragment),qa=o(),xl=s("span"),xl.textContent=Mo,wn=o(),Te=s("p"),Te.innerHTML=yo,jn=o(),Ce=s("p"),Ce.textContent=go,Tn=o(),Ue=s("p"),Ue.innerHTML=vo,Cn=o(),$e=s("p"),$e.textContent=bo,Un=o(),Je=s("ul"),Je.innerHTML=wo,$n=o(),ze=s("p"),ze.textContent=jo,Jn=o(),xe=s("ul"),xe.innerHTML=To,zn=o(),Z=s("h3"),P=s("a"),Pl=s("span"),h(_e.$$.fragment),Pa=o(),_l=s("span"),_l.textContent=Co,xn=o(),Ze=s("p"),Ze.textContent=Uo,_n=o(),h(ke.$$.fragment),Zn=o(),We=s("p"),We.innerHTML=$o,kn=o(),h(Ie.$$.fragment),Wn=o(),Ne=s("p"),Ne.textContent=Jo,In=o(),h(Ae.$$.fragment),Nn=o(),Be=s("p"),Be.textContent=zo,An=o(),h(Re.$$.fragment),Bn=o(),Ee=s("p"),Ee.innerHTML=xo,Rn=o(),Xe=s("p"),Xe.innerHTML=_o,En=o(),h(Ge.$$.fragment),Xn=o(),He=s("p"),He.innerHTML=Zo,Gn=o(),h(Ve.$$.fragment),Hn=o(),Se=s("p"),Se.innerHTML=ko,Vn=o(),h(Qe.$$.fragment),Sn=o(),Le=s("p"),Le.textContent=Wo,Qn=o(),h(Y.$$.fragment),Ln=o(),k=s("h3"),O=s("a"),Yl=s("span"),h(Fe.$$.fragment),Ya=o(),Zl=s("span"),Zl.textContent=Io,Fn=o(),qe=s("p"),qe.innerHTML=No,qn=o(),Pe=s("table"),Pe.innerHTML=Ao,Pn=o(),Ye=s("p"),Ye.innerHTML=Bo,Yn=o(),h(Oe.$$.fragment),On=o(),De=s("p"),De.innerHTML=Ro,Dn=o(),h(Ke.$$.fragment),Kn=o(),et=s("p"),et.textContent=Eo,es=o(),h(tt.$$.fragment),ts=o(),lt=s("p"),lt.innerHTML=Xo,ls=o(),h(D.$$.fragment),ns=o(),W=s("h3"),K=s("a"),Ol=s("span"),h(nt.$$.fragment),Oa=o(),kl=s("span"),kl.textContent=Go,ss=o(),st=s("p"),st.textContent=Ho,as=o(),at=s("ol"),at.innerHTML=Vo,os=o(),ot=s("p"),ot.textContent=So,is=o(),I=s("h4"),ee=s("a"),Dl=s("span"),h(it.$$.fragment),Da=o(),Wl=s("span"),Wl.textContent=Qo,rs=o(),rt=s("p"),rt.textContent=Lo,ps=o(),pt=s("ul"),pt.innerHTML=Fo,cs=o(),h(te.$$.fragment),us=o(),ct=s("p"),ct.innerHTML=qo,ds=o(),h(ut.$$.fragment),ms=o(),dt=s("p"),dt.innerHTML=Po,hs=o(),h(le.$$.fragment),fs=o(),mt=s("p"),mt.textContent=Yo,Ms=o(),h(ht.$$.fragment),ys=o(),ft=s("p"),ft.textContent=Oo,gs=o(),h(Mt.$$.fragment),vs=o(),yt=s("p"),yt.textContent=Do,bs=o(),h(gt.$$.fragment),ws=o(),vt=s("p"),vt.innerHTML=Ko,js=o(),h(bt.$$.fragment),Ts=o(),h(ne.$$.fragment),Cs=o(),N=s("h4"),se=s("a"),Kl=s("span"),h(wt.$$.fragment),Ka=o(),Il=s("span"),Il.textContent=ei,Us=o(),jt=s("p"),jt.innerHTML=ti,$s=o(),h(Tt.$$.fragment),Js=o(),Ct=s("p"),Ct.innerHTML=li,zs=o(),h(Ut.$$.fragment),xs=o(),h(ae.$$.fragment),_s=o(),A=s("h4"),oe=s("a"),en=s("span"),h($t.$$.fragment),eo=o(),Nl=s("span"),Nl.textContent=ni,Zs=o(),Jt=s("p"),Jt.innerHTML=si,ks=o(),h(zt.$$.fragment),Ws=o(),xt=s("p"),xt.innerHTML=ai,Is=o(),B=s("h3"),ie=s("a"),tn=s("span"),h(_t.$$.fragment),to=o(),Al=s("span"),Al.textContent=oi,Ns=o(),Zt=s("p"),Zt.textContent=ii,As=o(),kt=s("ul"),kt.innerHTML=ri,Bs=o(),Wt=s("p"),Wt.innerHTML=pi,Rs=o(),R=s("h2"),re=s("a"),ln=s("span"),h(It.$$.fragment),lo=o(),Bl=s("span"),Bl.textContent=ci,Es=o(),h(pe.$$.fragment),Xs=o(),Nt=s("p"),Nt.innerHTML=ui,Gs=o(),At=s("p"),At.textContent=di,Hs=o(),Bt=s("p"),Bt.textContent=mi,Vs=o(),Rt=s("ul"),Rt.innerHTML=hi,Ss=o(),Et=s("p"),Et.textContent=fi,Qs=o(),E=s("h3"),ce=s("a"),nn=s("span"),h(Xt.$$.fragment),no=o(),Rl=s("span"),Rl.textContent=Mi,Ls=o(),Gt=s("p"),Gt.textContent=yi,Fs=o(),Ht=s("p"),Ht.innerHTML=gi,qs=o(),Vt=s("p"),Vt.innerHTML=vi,Ps=o(),X=s("h3"),ue=s("a"),sn=s("span"),h(St.$$.fragment),so=o(),El=s("span"),El.textContent=bi,Ys=o(),Qt=s("p"),Qt.textContent=wi,Os=o(),Lt=s("p"),Lt.textContent=ji,Ds=o(),Ft=s("p"),Ft.innerHTML=Ti,Ks=o(),qt=s("p"),qt.textContent=Ci,ea=o(),Pt=s("p"),Pt.textContent=Ui,ta=o(),G=s("h3"),de=s("a"),an=s("span"),h(Yt.$$.fragment),ao=o(),Xl=s("span"),Xl.textContent=$i,la=o(),Ot=s("p"),Ot.textContent=Ji,na=o(),H=s("h4"),me=s("a"),on=s("span"),h(Dt.$$.fragment),oo=o(),Gl=s("span"),Gl.textContent=zi,sa=o(),Kt=s("p"),Kt.innerHTML=xi,aa=o(),h(el.$$.fragment),oa=o(),V=s("h4"),he=s("a"),rn=s("span"),h(tl.$$.fragment),io=o(),Hl=s("span"),Hl.textContent=_i,ia=o(),ll=s("p"),ll.innerHTML=Zi,ra=o(),h(nl.$$.fragment),pa=o(),S=s("h4"),fe=s("a"),pn=s("span"),h(sl.$$.fragment),ro=o(),Vl=s("span"),Vl.textContent=ki,ca=o(),al=s("p"),al.innerHTML=Wi,ua=o(),h(ol.$$.fragment),da=o(),il=s("p"),il.textContent=Ii,ma=o(),rl=s("p"),rl.innerHTML=Ni,ha=o(),pl=s("ol"),pl.innerHTML=Ai,fa=o(),Q=s("h4"),Me=s("a"),cn=s("span"),h(cl.$$.fragment),po=o(),Sl=s("span"),Sl.textContent=Bi,Ma=o(),ul=s("p"),ul.innerHTML=Ri,ya=o(),L=s("h4"),ye=s("a"),un=s("span"),h(dl.$$.fragment),co=o(),Ql=s("span"),Ql.textContent=Ei,ga=o(),ml=s("p"),ml.textContent=Xi,va=o(),hl=s("ul"),hl.innerHTML=Gi,ba=o(),F=s("h4"),ge=s("a"),dn=s("span"),h(fl.$$.fragment),uo=o(),Ll=s("span"),Ll.textContent=Hi,wa=o(),Ml=s("p"),Ml.innerHTML=Vi,ja=o(),h(yl.$$.fragment),Ta=o(),gl=s("p"),gl.textContent=Si,Ca=o(),vl=s("p"),vl.textContent=Qi,Ua=o(),h(bl.$$.fragment),$a=o(),wl=s("p"),wl.textContent=Li,Ja=o(),h(jl.$$.fragment),za=o(),Tl=s("p"),Tl.textContent=Fi,xa=o(),Cl=s("p"),Cl.innerHTML=qi,_a=o(),mn=s("p"),this.h()},l(e){const l=Ir("svelte-1phssyn",document.head);p=a(l,"META",{name:!0,content:!0}),l.forEach(t),w=i(e),c=a(e,"P",{}),m(c).forEach(t),j=i(e),C=a(e,"H1",{class:!0});var Ul=m(C);U=a(Ul,"A",{id:!0,class:!0,href:!0});var hn=m(U);z=a(hn,"SPAN",{});var fn=m(z);f(b.$$.fragment,fn),fn.forEach(t),hn.forEach(t),x=i(Ul),zl=a(Ul,"SPAN",{"data-svelte-h":!0}),r(zl)!=="svelte-gsezyo"&&(zl.textContent=mo),Ul.forEach(t),gn=i(e),be=a(e,"P",{"data-svelte-h":!0}),r(be)!=="svelte-do19d6"&&(be.textContent=ho),vn=i(e),we=a(e,"P",{"data-svelte-h":!0}),r(we)!=="svelte-1f9txfv"&&(we.innerHTML=fo),bn=i(e),_=a(e,"H2",{class:!0});var $l=m(_);q=a($l,"A",{id:!0,class:!0,href:!0});var Mn=m(q);ql=a(Mn,"SPAN",{});var yn=m(ql);f(je.$$.fragment,yn),yn.forEach(t),Mn.forEach(t),qa=i($l),xl=a($l,"SPAN",{"data-svelte-h":!0}),r(xl)!=="svelte-1cstgs8"&&(xl.textContent=Mo),$l.forEach(t),wn=i(e),Te=a(e,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-1gdh4oo"&&(Te.innerHTML=yo),jn=i(e),Ce=a(e,"P",{"data-svelte-h":!0}),r(Ce)!=="svelte-z64a5j"&&(Ce.textContent=go),Tn=i(e),Ue=a(e,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-7rl71e"&&(Ue.innerHTML=vo),Cn=i(e),$e=a(e,"P",{"data-svelte-h":!0}),r($e)!=="svelte-sr712u"&&($e.textContent=bo),Un=i(e),Je=a(e,"UL",{"data-svelte-h":!0}),r(Je)!=="svelte-vozkex"&&(Je.innerHTML=wo),$n=i(e),ze=a(e,"P",{"data-svelte-h":!0}),r(ze)!=="svelte-1sn7n41"&&(ze.textContent=jo),Jn=i(e),xe=a(e,"UL",{"data-svelte-h":!0}),r(xe)!=="svelte-1g8hsur"&&(xe.innerHTML=To),zn=i(e),Z=a(e,"H3",{class:!0});var Jl=m(Z);P=a(Jl,"A",{id:!0,class:!0,href:!0});var Pi=m(P);Pl=a(Pi,"SPAN",{});var Yi=m(Pl);f(_e.$$.fragment,Yi),Yi.forEach(t),Pi.forEach(t),Pa=i(Jl),_l=a(Jl,"SPAN",{"data-svelte-h":!0}),r(_l)!=="svelte-38127q"&&(_l.textContent=Co),Jl.forEach(t),xn=i(e),Ze=a(e,"P",{"data-svelte-h":!0}),r(Ze)!=="svelte-4psczp"&&(Ze.textContent=Uo),_n=i(e),f(ke.$$.fragment,e),Zn=i(e),We=a(e,"P",{"data-svelte-h":!0}),r(We)!=="svelte-1j72zvu"&&(We.innerHTML=$o),kn=i(e),f(Ie.$$.fragment,e),Wn=i(e),Ne=a(e,"P",{"data-svelte-h":!0}),r(Ne)!=="svelte-13jbmoq"&&(Ne.textContent=Jo),In=i(e),f(Ae.$$.fragment,e),Nn=i(e),Be=a(e,"P",{"data-svelte-h":!0}),r(Be)!=="svelte-wxqvf3"&&(Be.textContent=zo),An=i(e),f(Re.$$.fragment,e),Bn=i(e),Ee=a(e,"P",{"data-svelte-h":!0}),r(Ee)!=="svelte-1quc6jn"&&(Ee.innerHTML=xo),Rn=i(e),Xe=a(e,"P",{"data-svelte-h":!0}),r(Xe)!=="svelte-rdoavc"&&(Xe.innerHTML=_o),En=i(e),f(Ge.$$.fragment,e),Xn=i(e),He=a(e,"P",{"data-svelte-h":!0}),r(He)!=="svelte-1t39lef"&&(He.innerHTML=Zo),Gn=i(e),f(Ve.$$.fragment,e),Hn=i(e),Se=a(e,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-ej8fgq"&&(Se.innerHTML=ko),Vn=i(e),f(Qe.$$.fragment,e),Sn=i(e),Le=a(e,"P",{"data-svelte-h":!0}),r(Le)!=="svelte-h5zd9u"&&(Le.textContent=Wo),Qn=i(e),f(Y.$$.fragment,e),Ln=i(e),k=a(e,"H3",{class:!0});var ka=m(k);O=a(ka,"A",{id:!0,class:!0,href:!0});var Oi=m(O);Yl=a(Oi,"SPAN",{});var Di=m(Yl);f(Fe.$$.fragment,Di),Di.forEach(t),Oi.forEach(t),Ya=i(ka),Zl=a(ka,"SPAN",{"data-svelte-h":!0}),r(Zl)!=="svelte-1xp6fy"&&(Zl.textContent=Io),ka.forEach(t),Fn=i(e),qe=a(e,"P",{"data-svelte-h":!0}),r(qe)!=="svelte-ne5myz"&&(qe.innerHTML=No),qn=i(e),Pe=a(e,"TABLE",{"data-svelte-h":!0}),r(Pe)!=="svelte-1n68aa"&&(Pe.innerHTML=Ao),Pn=i(e),Ye=a(e,"P",{"data-svelte-h":!0}),r(Ye)!=="svelte-6wtiyv"&&(Ye.innerHTML=Bo),Yn=i(e),f(Oe.$$.fragment,e),On=i(e),De=a(e,"P",{"data-svelte-h":!0}),r(De)!=="svelte-3qfl60"&&(De.innerHTML=Ro),Dn=i(e),f(Ke.$$.fragment,e),Kn=i(e),et=a(e,"P",{"data-svelte-h":!0}),r(et)!=="svelte-lgu95w"&&(et.textContent=Eo),es=i(e),f(tt.$$.fragment,e),ts=i(e),lt=a(e,"P",{"data-svelte-h":!0}),r(lt)!=="svelte-1eltngq"&&(lt.innerHTML=Xo),ls=i(e),f(D.$$.fragment,e),ns=i(e),W=a(e,"H3",{class:!0});var Wa=m(W);K=a(Wa,"A",{id:!0,class:!0,href:!0});var Ki=m(K);Ol=a(Ki,"SPAN",{});var er=m(Ol);f(nt.$$.fragment,er),er.forEach(t),Ki.forEach(t),Oa=i(Wa),kl=a(Wa,"SPAN",{"data-svelte-h":!0}),r(kl)!=="svelte-12o9to9"&&(kl.textContent=Go),Wa.forEach(t),ss=i(e),st=a(e,"P",{"data-svelte-h":!0}),r(st)!=="svelte-17r0w1i"&&(st.textContent=Ho),as=i(e),at=a(e,"OL",{"data-svelte-h":!0}),r(at)!=="svelte-z67jz4"&&(at.innerHTML=Vo),os=i(e),ot=a(e,"P",{"data-svelte-h":!0}),r(ot)!=="svelte-10yqqq8"&&(ot.textContent=So),is=i(e),I=a(e,"H4",{class:!0});var Ia=m(I);ee=a(Ia,"A",{id:!0,class:!0,href:!0});var tr=m(ee);Dl=a(tr,"SPAN",{});var lr=m(Dl);f(it.$$.fragment,lr),lr.forEach(t),tr.forEach(t),Da=i(Ia),Wl=a(Ia,"SPAN",{"data-svelte-h":!0}),r(Wl)!=="svelte-pwofpg"&&(Wl.textContent=Qo),Ia.forEach(t),rs=i(e),rt=a(e,"P",{"data-svelte-h":!0}),r(rt)!=="svelte-trahak"&&(rt.textContent=Lo),ps=i(e),pt=a(e,"UL",{"data-svelte-h":!0}),r(pt)!=="svelte-j9of43"&&(pt.innerHTML=Fo),cs=i(e),f(te.$$.fragment,e),us=i(e),ct=a(e,"P",{"data-svelte-h":!0}),r(ct)!=="svelte-1jb3jgn"&&(ct.innerHTML=qo),ds=i(e),f(ut.$$.fragment,e),ms=i(e),dt=a(e,"P",{"data-svelte-h":!0}),r(dt)!=="svelte-13xj4dt"&&(dt.innerHTML=Po),hs=i(e),f(le.$$.fragment,e),fs=i(e),mt=a(e,"P",{"data-svelte-h":!0}),r(mt)!=="svelte-w0rck2"&&(mt.textContent=Yo),Ms=i(e),f(ht.$$.fragment,e),ys=i(e),ft=a(e,"P",{"data-svelte-h":!0}),r(ft)!=="svelte-6wsqkw"&&(ft.textContent=Oo),gs=i(e),f(Mt.$$.fragment,e),vs=i(e),yt=a(e,"P",{"data-svelte-h":!0}),r(yt)!=="svelte-1ggtlqz"&&(yt.textContent=Do),bs=i(e),f(gt.$$.fragment,e),ws=i(e),vt=a(e,"P",{"data-svelte-h":!0}),r(vt)!=="svelte-1kn83vw"&&(vt.innerHTML=Ko),js=i(e),f(bt.$$.fragment,e),Ts=i(e),f(ne.$$.fragment,e),Cs=i(e),N=a(e,"H4",{class:!0});var Na=m(N);se=a(Na,"A",{id:!0,class:!0,href:!0});var nr=m(se);Kl=a(nr,"SPAN",{});var sr=m(Kl);f(wt.$$.fragment,sr),sr.forEach(t),nr.forEach(t),Ka=i(Na),Il=a(Na,"SPAN",{"data-svelte-h":!0}),r(Il)!=="svelte-130j6il"&&(Il.textContent=ei),Na.forEach(t),Us=i(e),jt=a(e,"P",{"data-svelte-h":!0}),r(jt)!=="svelte-1ocrgze"&&(jt.innerHTML=ti),$s=i(e),f(Tt.$$.fragment,e),Js=i(e),Ct=a(e,"P",{"data-svelte-h":!0}),r(Ct)!=="svelte-kxw9bj"&&(Ct.innerHTML=li),zs=i(e),f(Ut.$$.fragment,e),xs=i(e),f(ae.$$.fragment,e),_s=i(e),A=a(e,"H4",{class:!0});var Aa=m(A);oe=a(Aa,"A",{id:!0,class:!0,href:!0});var ar=m(oe);en=a(ar,"SPAN",{});var or=m(en);f($t.$$.fragment,or),or.forEach(t),ar.forEach(t),eo=i(Aa),Nl=a(Aa,"SPAN",{"data-svelte-h":!0}),r(Nl)!=="svelte-1yzlsyr"&&(Nl.textContent=ni),Aa.forEach(t),Zs=i(e),Jt=a(e,"P",{"data-svelte-h":!0}),r(Jt)!=="svelte-zllt9o"&&(Jt.innerHTML=si),ks=i(e),f(zt.$$.fragment,e),Ws=i(e),xt=a(e,"P",{"data-svelte-h":!0}),r(xt)!=="svelte-1c44gg3"&&(xt.innerHTML=ai),Is=i(e),B=a(e,"H3",{class:!0});var Ba=m(B);ie=a(Ba,"A",{id:!0,class:!0,href:!0});var ir=m(ie);tn=a(ir,"SPAN",{});var rr=m(tn);f(_t.$$.fragment,rr),rr.forEach(t),ir.forEach(t),to=i(Ba),Al=a(Ba,"SPAN",{"data-svelte-h":!0}),r(Al)!=="svelte-u01l9t"&&(Al.textContent=oi),Ba.forEach(t),Ns=i(e),Zt=a(e,"P",{"data-svelte-h":!0}),r(Zt)!=="svelte-lrvm1j"&&(Zt.textContent=ii),As=i(e),kt=a(e,"UL",{"data-svelte-h":!0}),r(kt)!=="svelte-a8pd1a"&&(kt.innerHTML=ri),Bs=i(e),Wt=a(e,"P",{"data-svelte-h":!0}),r(Wt)!=="svelte-vgj3gr"&&(Wt.innerHTML=pi),Rs=i(e),R=a(e,"H2",{class:!0});var Ra=m(R);re=a(Ra,"A",{id:!0,class:!0,href:!0});var pr=m(re);ln=a(pr,"SPAN",{});var cr=m(ln);f(It.$$.fragment,cr),cr.forEach(t),pr.forEach(t),lo=i(Ra),Bl=a(Ra,"SPAN",{"data-svelte-h":!0}),r(Bl)!=="svelte-d2eeha"&&(Bl.textContent=ci),Ra.forEach(t),Es=i(e),f(pe.$$.fragment,e),Xs=i(e),Nt=a(e,"P",{"data-svelte-h":!0}),r(Nt)!=="svelte-wgebc9"&&(Nt.innerHTML=ui),Gs=i(e),At=a(e,"P",{"data-svelte-h":!0}),r(At)!=="svelte-9p2ixq"&&(At.textContent=di),Hs=i(e),Bt=a(e,"P",{"data-svelte-h":!0}),r(Bt)!=="svelte-6xn7nf"&&(Bt.textContent=mi),Vs=i(e),Rt=a(e,"UL",{"data-svelte-h":!0}),r(Rt)!=="svelte-oy2125"&&(Rt.innerHTML=hi),Ss=i(e),Et=a(e,"P",{"data-svelte-h":!0}),r(Et)!=="svelte-m48voh"&&(Et.textContent=fi),Qs=i(e),E=a(e,"H3",{class:!0});var Ea=m(E);ce=a(Ea,"A",{id:!0,class:!0,href:!0});var ur=m(ce);nn=a(ur,"SPAN",{});var dr=m(nn);f(Xt.$$.fragment,dr),dr.forEach(t),ur.forEach(t),no=i(Ea),Rl=a(Ea,"SPAN",{"data-svelte-h":!0}),r(Rl)!=="svelte-1iaumwy"&&(Rl.textContent=Mi),Ea.forEach(t),Ls=i(e),Gt=a(e,"P",{"data-svelte-h":!0}),r(Gt)!=="svelte-tz9w6u"&&(Gt.textContent=yi),Fs=i(e),Ht=a(e,"P",{"data-svelte-h":!0}),r(Ht)!=="svelte-1mq7t8t"&&(Ht.innerHTML=gi),qs=i(e),Vt=a(e,"P",{"data-svelte-h":!0}),r(Vt)!=="svelte-1jmydvh"&&(Vt.innerHTML=vi),Ps=i(e),X=a(e,"H3",{class:!0});var Xa=m(X);ue=a(Xa,"A",{id:!0,class:!0,href:!0});var mr=m(ue);sn=a(mr,"SPAN",{});var hr=m(sn);f(St.$$.fragment,hr),hr.forEach(t),mr.forEach(t),so=i(Xa),El=a(Xa,"SPAN",{"data-svelte-h":!0}),r(El)!=="svelte-pec7nv"&&(El.textContent=bi),Xa.forEach(t),Ys=i(e),Qt=a(e,"P",{"data-svelte-h":!0}),r(Qt)!=="svelte-c132kv"&&(Qt.textContent=wi),Os=i(e),Lt=a(e,"P",{"data-svelte-h":!0}),r(Lt)!=="svelte-1bggopo"&&(Lt.textContent=ji),Ds=i(e),Ft=a(e,"P",{"data-svelte-h":!0}),r(Ft)!=="svelte-vyea1g"&&(Ft.innerHTML=Ti),Ks=i(e),qt=a(e,"P",{"data-svelte-h":!0}),r(qt)!=="svelte-1yce0u1"&&(qt.textContent=Ci),ea=i(e),Pt=a(e,"P",{"data-svelte-h":!0}),r(Pt)!=="svelte-1sr04ao"&&(Pt.textContent=Ui),ta=i(e),G=a(e,"H3",{class:!0});var Ga=m(G);de=a(Ga,"A",{id:!0,class:!0,href:!0});var fr=m(de);an=a(fr,"SPAN",{});var Mr=m(an);f(Yt.$$.fragment,Mr),Mr.forEach(t),fr.forEach(t),ao=i(Ga),Xl=a(Ga,"SPAN",{"data-svelte-h":!0}),r(Xl)!=="svelte-r0eu0a"&&(Xl.textContent=$i),Ga.forEach(t),la=i(e),Ot=a(e,"P",{"data-svelte-h":!0}),r(Ot)!=="svelte-q23m3c"&&(Ot.textContent=Ji),na=i(e),H=a(e,"H4",{class:!0});var Ha=m(H);me=a(Ha,"A",{id:!0,class:!0,href:!0});var yr=m(me);on=a(yr,"SPAN",{});var gr=m(on);f(Dt.$$.fragment,gr),gr.forEach(t),yr.forEach(t),oo=i(Ha),Gl=a(Ha,"SPAN",{"data-svelte-h":!0}),r(Gl)!=="svelte-nrsev0"&&(Gl.textContent=zi),Ha.forEach(t),sa=i(e),Kt=a(e,"P",{"data-svelte-h":!0}),r(Kt)!=="svelte-k16qri"&&(Kt.innerHTML=xi),aa=i(e),f(el.$$.fragment,e),oa=i(e),V=a(e,"H4",{class:!0});var Va=m(V);he=a(Va,"A",{id:!0,class:!0,href:!0});var vr=m(he);rn=a(vr,"SPAN",{});var br=m(rn);f(tl.$$.fragment,br),br.forEach(t),vr.forEach(t),io=i(Va),Hl=a(Va,"SPAN",{"data-svelte-h":!0}),r(Hl)!=="svelte-11r3z4s"&&(Hl.textContent=_i),Va.forEach(t),ia=i(e),ll=a(e,"P",{"data-svelte-h":!0}),r(ll)!=="svelte-wh65i"&&(ll.innerHTML=Zi),ra=i(e),f(nl.$$.fragment,e),pa=i(e),S=a(e,"H4",{class:!0});var Sa=m(S);fe=a(Sa,"A",{id:!0,class:!0,href:!0});var wr=m(fe);pn=a(wr,"SPAN",{});var jr=m(pn);f(sl.$$.fragment,jr),jr.forEach(t),wr.forEach(t),ro=i(Sa),Vl=a(Sa,"SPAN",{"data-svelte-h":!0}),r(Vl)!=="svelte-1fh2m3j"&&(Vl.textContent=ki),Sa.forEach(t),ca=i(e),al=a(e,"P",{"data-svelte-h":!0}),r(al)!=="svelte-1gnslzu"&&(al.innerHTML=Wi),ua=i(e),f(ol.$$.fragment,e),da=i(e),il=a(e,"P",{"data-svelte-h":!0}),r(il)!=="svelte-mniffs"&&(il.textContent=Ii),ma=i(e),rl=a(e,"P",{"data-svelte-h":!0}),r(rl)!=="svelte-fjq776"&&(rl.innerHTML=Ni),ha=i(e),pl=a(e,"OL",{"data-svelte-h":!0}),r(pl)!=="svelte-121gcdu"&&(pl.innerHTML=Ai),fa=i(e),Q=a(e,"H4",{class:!0});var Qa=m(Q);Me=a(Qa,"A",{id:!0,class:!0,href:!0});var Tr=m(Me);cn=a(Tr,"SPAN",{});var Cr=m(cn);f(cl.$$.fragment,Cr),Cr.forEach(t),Tr.forEach(t),po=i(Qa),Sl=a(Qa,"SPAN",{"data-svelte-h":!0}),r(Sl)!=="svelte-19su2cl"&&(Sl.textContent=Bi),Qa.forEach(t),Ma=i(e),ul=a(e,"P",{"data-svelte-h":!0}),r(ul)!=="svelte-nfv9dr"&&(ul.innerHTML=Ri),ya=i(e),L=a(e,"H4",{class:!0});var La=m(L);ye=a(La,"A",{id:!0,class:!0,href:!0});var Ur=m(ye);un=a(Ur,"SPAN",{});var $r=m(un);f(dl.$$.fragment,$r),$r.forEach(t),Ur.forEach(t),co=i(La),Ql=a(La,"SPAN",{"data-svelte-h":!0}),r(Ql)!=="svelte-5bgoqx"&&(Ql.textContent=Ei),La.forEach(t),ga=i(e),ml=a(e,"P",{"data-svelte-h":!0}),r(ml)!=="svelte-clfp9m"&&(ml.textContent=Xi),va=i(e),hl=a(e,"UL",{"data-svelte-h":!0}),r(hl)!=="svelte-1yjzy16"&&(hl.innerHTML=Gi),ba=i(e),F=a(e,"H4",{class:!0});var Fa=m(F);ge=a(Fa,"A",{id:!0,class:!0,href:!0});var Jr=m(ge);dn=a(Jr,"SPAN",{});var zr=m(dn);f(fl.$$.fragment,zr),zr.forEach(t),Jr.forEach(t),uo=i(Fa),Ll=a(Fa,"SPAN",{"data-svelte-h":!0}),r(Ll)!=="svelte-dd2mns"&&(Ll.textContent=Hi),Fa.forEach(t),wa=i(e),Ml=a(e,"P",{"data-svelte-h":!0}),r(Ml)!=="svelte-wberyk"&&(Ml.innerHTML=Vi),ja=i(e),f(yl.$$.fragment,e),Ta=i(e),gl=a(e,"P",{"data-svelte-h":!0}),r(gl)!=="svelte-e7n7t3"&&(gl.textContent=Si),Ca=i(e),vl=a(e,"P",{"data-svelte-h":!0}),r(vl)!=="svelte-yedjtf"&&(vl.textContent=Qi),Ua=i(e),f(bl.$$.fragment,e),$a=i(e),wl=a(e,"P",{"data-svelte-h":!0}),r(wl)!=="svelte-a9ap49"&&(wl.textContent=Li),Ja=i(e),f(jl.$$.fragment,e),za=i(e),Tl=a(e,"P",{"data-svelte-h":!0}),r(Tl)!=="svelte-1pjct15"&&(Tl.textContent=Fi),xa=i(e),Cl=a(e,"P",{"data-svelte-h":!0}),r(Cl)!=="svelte-1do2s1n"&&(Cl.innerHTML=qi),_a=i(e),mn=a(e,"P",{}),m(mn).forEach(t),this.h()},h(){u(p,"name","hf:doc:metadata"),u(p,"content",JSON.stringify(Fr)),u(U,"id","esporta-modelli-transformers"),u(U,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(U,"href","#esporta-modelli-transformers"),u(C,"class","relative group"),u(q,"id","onnx"),u(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(q,"href","#onnx"),u(_,"class","relative group"),u(P,"id","esportazione-di-un-modello-in-onnx"),u(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(P,"href","#esportazione-di-un-modello-in-onnx"),u(Z,"class","relative group"),u(O,"id","selezione-delle-caratteristiche-per-diverse-topologie-di-modello"),u(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(O,"href","#selezione-delle-caratteristiche-per-diverse-topologie-di-modello"),u(k,"class","relative group"),u(K,"id","esportazione-di-un-modello-per-unarchitettura-non-supportata"),u(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(K,"href","#esportazione-di-un-modello-per-unarchitettura-non-supportata"),u(W,"class","relative group"),u(ee,"id","implementazione-di-una-configurazione-onnx-personalizzata"),u(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ee,"href","#implementazione-di-una-configurazione-onnx-personalizzata"),u(I,"class","relative group"),u(se,"id","esportazione-del-modello"),u(se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(se,"href","#esportazione-del-modello"),u(N,"class","relative group"),u(oe,"id","convalida-degli-output-del-modello"),u(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(oe,"href","#convalida-degli-output-del-modello"),u(A,"class","relative group"),u(ie,"id","contribuire-con-una-nuova-configurazione-a-transformers"),u(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ie,"href","#contribuire-con-una-nuova-configurazione-a-transformers"),u(B,"class","relative group"),u(re,"id","torchscript"),u(re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(re,"href","#torchscript"),u(R,"class","relative group"),u(ce,"id","flag-torchscript-e-pesi-legati"),u(ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ce,"href","#flag-torchscript-e-pesi-legati"),u(E,"class","relative group"),u(ue,"id","input-fittizi-e-standard-lengths"),u(ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ue,"href","#input-fittizi-e-standard-lengths"),u(X,"class","relative group"),u(de,"id","usare-torchsscript-in-python"),u(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(de,"href","#usare-torchsscript-in-python"),u(G,"class","relative group"),u(me,"id","salvare-un-modello"),u(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(me,"href","#salvare-un-modello"),u(H,"class","relative group"),u(he,"id","caricare-un-modello"),u(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(he,"href","#caricare-un-modello"),u(V,"class","relative group"),u(fe,"id","utilizzare-un-modello-tracciato-per-linferenza"),u(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(fe,"href","#utilizzare-un-modello-tracciato-per-linferenza"),u(S,"class","relative group"),u(Me,"id","implicazioni"),u(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Me,"href","#implicazioni"),u(Q,"class","relative group"),u(ye,"id","dipendenze"),u(ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ye,"href","#dipendenze"),u(L,"class","relative group"),u(ge,"id","convertire-un-modello-per-aws-neuron"),u(ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ge,"href","#convertire-un-modello-per-aws-neuron"),u(F,"class","relative group")},m(e,l){d(document.head,p),n(e,w,l),n(e,c,l),n(e,j,l),n(e,C,l),d(C,U),d(U,z),M(b,z,null),d(C,x),d(C,zl),n(e,gn,l),n(e,be,l),n(e,vn,l),n(e,we,l),n(e,bn,l),n(e,_,l),d(_,q),d(q,ql),M(je,ql,null),d(_,qa),d(_,xl),n(e,wn,l),n(e,Te,l),n(e,jn,l),n(e,Ce,l),n(e,Tn,l),n(e,Ue,l),n(e,Cn,l),n(e,$e,l),n(e,Un,l),n(e,Je,l),n(e,$n,l),n(e,ze,l),n(e,Jn,l),n(e,xe,l),n(e,zn,l),n(e,Z,l),d(Z,P),d(P,Pl),M(_e,Pl,null),d(Z,Pa),d(Z,_l),n(e,xn,l),n(e,Ze,l),n(e,_n,l),M(ke,e,l),n(e,Zn,l),n(e,We,l),n(e,kn,l),M(Ie,e,l),n(e,Wn,l),n(e,Ne,l),n(e,In,l),M(Ae,e,l),n(e,Nn,l),n(e,Be,l),n(e,An,l),M(Re,e,l),n(e,Bn,l),n(e,Ee,l),n(e,Rn,l),n(e,Xe,l),n(e,En,l),M(Ge,e,l),n(e,Xn,l),n(e,He,l),n(e,Gn,l),M(Ve,e,l),n(e,Hn,l),n(e,Se,l),n(e,Vn,l),M(Qe,e,l),n(e,Sn,l),n(e,Le,l),n(e,Qn,l),M(Y,e,l),n(e,Ln,l),n(e,k,l),d(k,O),d(O,Yl),M(Fe,Yl,null),d(k,Ya),d(k,Zl),n(e,Fn,l),n(e,qe,l),n(e,qn,l),n(e,Pe,l),n(e,Pn,l),n(e,Ye,l),n(e,Yn,l),M(Oe,e,l),n(e,On,l),n(e,De,l),n(e,Dn,l),M(Ke,e,l),n(e,Kn,l),n(e,et,l),n(e,es,l),M(tt,e,l),n(e,ts,l),n(e,lt,l),n(e,ls,l),M(D,e,l),n(e,ns,l),n(e,W,l),d(W,K),d(K,Ol),M(nt,Ol,null),d(W,Oa),d(W,kl),n(e,ss,l),n(e,st,l),n(e,as,l),n(e,at,l),n(e,os,l),n(e,ot,l),n(e,is,l),n(e,I,l),d(I,ee),d(ee,Dl),M(it,Dl,null),d(I,Da),d(I,Wl),n(e,rs,l),n(e,rt,l),n(e,ps,l),n(e,pt,l),n(e,cs,l),M(te,e,l),n(e,us,l),n(e,ct,l),n(e,ds,l),M(ut,e,l),n(e,ms,l),n(e,dt,l),n(e,hs,l),M(le,e,l),n(e,fs,l),n(e,mt,l),n(e,Ms,l),M(ht,e,l),n(e,ys,l),n(e,ft,l),n(e,gs,l),M(Mt,e,l),n(e,vs,l),n(e,yt,l),n(e,bs,l),M(gt,e,l),n(e,ws,l),n(e,vt,l),n(e,js,l),M(bt,e,l),n(e,Ts,l),M(ne,e,l),n(e,Cs,l),n(e,N,l),d(N,se),d(se,Kl),M(wt,Kl,null),d(N,Ka),d(N,Il),n(e,Us,l),n(e,jt,l),n(e,$s,l),M(Tt,e,l),n(e,Js,l),n(e,Ct,l),n(e,zs,l),M(Ut,e,l),n(e,xs,l),M(ae,e,l),n(e,_s,l),n(e,A,l),d(A,oe),d(oe,en),M($t,en,null),d(A,eo),d(A,Nl),n(e,Zs,l),n(e,Jt,l),n(e,ks,l),M(zt,e,l),n(e,Ws,l),n(e,xt,l),n(e,Is,l),n(e,B,l),d(B,ie),d(ie,tn),M(_t,tn,null),d(B,to),d(B,Al),n(e,Ns,l),n(e,Zt,l),n(e,As,l),n(e,kt,l),n(e,Bs,l),n(e,Wt,l),n(e,Rs,l),n(e,R,l),d(R,re),d(re,ln),M(It,ln,null),d(R,lo),d(R,Bl),n(e,Es,l),M(pe,e,l),n(e,Xs,l),n(e,Nt,l),n(e,Gs,l),n(e,At,l),n(e,Hs,l),n(e,Bt,l),n(e,Vs,l),n(e,Rt,l),n(e,Ss,l),n(e,Et,l),n(e,Qs,l),n(e,E,l),d(E,ce),d(ce,nn),M(Xt,nn,null),d(E,no),d(E,Rl),n(e,Ls,l),n(e,Gt,l),n(e,Fs,l),n(e,Ht,l),n(e,qs,l),n(e,Vt,l),n(e,Ps,l),n(e,X,l),d(X,ue),d(ue,sn),M(St,sn,null),d(X,so),d(X,El),n(e,Ys,l),n(e,Qt,l),n(e,Os,l),n(e,Lt,l),n(e,Ds,l),n(e,Ft,l),n(e,Ks,l),n(e,qt,l),n(e,ea,l),n(e,Pt,l),n(e,ta,l),n(e,G,l),d(G,de),d(de,an),M(Yt,an,null),d(G,ao),d(G,Xl),n(e,la,l),n(e,Ot,l),n(e,na,l),n(e,H,l),d(H,me),d(me,on),M(Dt,on,null),d(H,oo),d(H,Gl),n(e,sa,l),n(e,Kt,l),n(e,aa,l),M(el,e,l),n(e,oa,l),n(e,V,l),d(V,he),d(he,rn),M(tl,rn,null),d(V,io),d(V,Hl),n(e,ia,l),n(e,ll,l),n(e,ra,l),M(nl,e,l),n(e,pa,l),n(e,S,l),d(S,fe),d(fe,pn),M(sl,pn,null),d(S,ro),d(S,Vl),n(e,ca,l),n(e,al,l),n(e,ua,l),M(ol,e,l),n(e,da,l),n(e,il,l),n(e,ma,l),n(e,rl,l),n(e,ha,l),n(e,pl,l),n(e,fa,l),n(e,Q,l),d(Q,Me),d(Me,cn),M(cl,cn,null),d(Q,po),d(Q,Sl),n(e,Ma,l),n(e,ul,l),n(e,ya,l),n(e,L,l),d(L,ye),d(ye,un),M(dl,un,null),d(L,co),d(L,Ql),n(e,ga,l),n(e,ml,l),n(e,va,l),n(e,hl,l),n(e,ba,l),n(e,F,l),d(F,ge),d(ge,dn),M(fl,dn,null),d(F,uo),d(F,Ll),n(e,wa,l),n(e,Ml,l),n(e,ja,l),M(yl,e,l),n(e,Ta,l),n(e,gl,l),n(e,Ca,l),n(e,vl,l),n(e,Ua,l),M(bl,e,l),n(e,$a,l),n(e,wl,l),n(e,Ja,l),M(jl,e,l),n(e,za,l),n(e,Tl,l),n(e,xa,l),n(e,Cl,l),n(e,_a,l),n(e,mn,l),Za=!0},p(e,[l]){const Ul={};l&2&&(Ul.$$scope={dirty:l,ctx:e}),Y.$set(Ul);const hn={};l&2&&(hn.$$scope={dirty:l,ctx:e}),D.$set(hn);const fn={};l&2&&(fn.$$scope={dirty:l,ctx:e}),te.$set(fn);const $l={};l&2&&($l.$$scope={dirty:l,ctx:e}),le.$set($l);const Mn={};l&2&&(Mn.$$scope={dirty:l,ctx:e}),ne.$set(Mn);const yn={};l&2&&(yn.$$scope={dirty:l,ctx:e}),ae.$set(yn);const Jl={};l&2&&(Jl.$$scope={dirty:l,ctx:e}),pe.$set(Jl)},i(e){Za||(y(b.$$.fragment,e),y(je.$$.fragment,e),y(_e.$$.fragment,e),y(ke.$$.fragment,e),y(Ie.$$.fragment,e),y(Ae.$$.fragment,e),y(Re.$$.fragment,e),y(Ge.$$.fragment,e),y(Ve.$$.fragment,e),y(Qe.$$.fragment,e),y(Y.$$.fragment,e),y(Fe.$$.fragment,e),y(Oe.$$.fragment,e),y(Ke.$$.fragment,e),y(tt.$$.fragment,e),y(D.$$.fragment,e),y(nt.$$.fragment,e),y(it.$$.fragment,e),y(te.$$.fragment,e),y(ut.$$.fragment,e),y(le.$$.fragment,e),y(ht.$$.fragment,e),y(Mt.$$.fragment,e),y(gt.$$.fragment,e),y(bt.$$.fragment,e),y(ne.$$.fragment,e),y(wt.$$.fragment,e),y(Tt.$$.fragment,e),y(Ut.$$.fragment,e),y(ae.$$.fragment,e),y($t.$$.fragment,e),y(zt.$$.fragment,e),y(_t.$$.fragment,e),y(It.$$.fragment,e),y(pe.$$.fragment,e),y(Xt.$$.fragment,e),y(St.$$.fragment,e),y(Yt.$$.fragment,e),y(Dt.$$.fragment,e),y(el.$$.fragment,e),y(tl.$$.fragment,e),y(nl.$$.fragment,e),y(sl.$$.fragment,e),y(ol.$$.fragment,e),y(cl.$$.fragment,e),y(dl.$$.fragment,e),y(fl.$$.fragment,e),y(yl.$$.fragment,e),y(bl.$$.fragment,e),y(jl.$$.fragment,e),Za=!0)},o(e){g(b.$$.fragment,e),g(je.$$.fragment,e),g(_e.$$.fragment,e),g(ke.$$.fragment,e),g(Ie.$$.fragment,e),g(Ae.$$.fragment,e),g(Re.$$.fragment,e),g(Ge.$$.fragment,e),g(Ve.$$.fragment,e),g(Qe.$$.fragment,e),g(Y.$$.fragment,e),g(Fe.$$.fragment,e),g(Oe.$$.fragment,e),g(Ke.$$.fragment,e),g(tt.$$.fragment,e),g(D.$$.fragment,e),g(nt.$$.fragment,e),g(it.$$.fragment,e),g(te.$$.fragment,e),g(ut.$$.fragment,e),g(le.$$.fragment,e),g(ht.$$.fragment,e),g(Mt.$$.fragment,e),g(gt.$$.fragment,e),g(bt.$$.fragment,e),g(ne.$$.fragment,e),g(wt.$$.fragment,e),g(Tt.$$.fragment,e),g(Ut.$$.fragment,e),g(ae.$$.fragment,e),g($t.$$.fragment,e),g(zt.$$.fragment,e),g(_t.$$.fragment,e),g(It.$$.fragment,e),g(pe.$$.fragment,e),g(Xt.$$.fragment,e),g(St.$$.fragment,e),g(Yt.$$.fragment,e),g(Dt.$$.fragment,e),g(el.$$.fragment,e),g(tl.$$.fragment,e),g(nl.$$.fragment,e),g(sl.$$.fragment,e),g(ol.$$.fragment,e),g(cl.$$.fragment,e),g(dl.$$.fragment,e),g(fl.$$.fragment,e),g(yl.$$.fragment,e),g(bl.$$.fragment,e),g(jl.$$.fragment,e),Za=!1},d(e){e&&(t(w),t(c),t(j),t(C),t(gn),t(be),t(vn),t(we),t(bn),t(_),t(wn),t(Te),t(jn),t(Ce),t(Tn),t(Ue),t(Cn),t($e),t(Un),t(Je),t($n),t(ze),t(Jn),t(xe),t(zn),t(Z),t(xn),t(Ze),t(_n),t(Zn),t(We),t(kn),t(Wn),t(Ne),t(In),t(Nn),t(Be),t(An),t(Bn),t(Ee),t(Rn),t(Xe),t(En),t(Xn),t(He),t(Gn),t(Hn),t(Se),t(Vn),t(Sn),t(Le),t(Qn),t(Ln),t(k),t(Fn),t(qe),t(qn),t(Pe),t(Pn),t(Ye),t(Yn),t(On),t(De),t(Dn),t(Kn),t(et),t(es),t(ts),t(lt),t(ls),t(ns),t(W),t(ss),t(st),t(as),t(at),t(os),t(ot),t(is),t(I),t(rs),t(rt),t(ps),t(pt),t(cs),t(us),t(ct),t(ds),t(ms),t(dt),t(hs),t(fs),t(mt),t(Ms),t(ys),t(ft),t(gs),t(vs),t(yt),t(bs),t(ws),t(vt),t(js),t(Ts),t(Cs),t(N),t(Us),t(jt),t($s),t(Js),t(Ct),t(zs),t(xs),t(_s),t(A),t(Zs),t(Jt),t(ks),t(Ws),t(xt),t(Is),t(B),t(Ns),t(Zt),t(As),t(kt),t(Bs),t(Wt),t(Rs),t(R),t(Es),t(Xs),t(Nt),t(Gs),t(At),t(Hs),t(Bt),t(Vs),t(Rt),t(Ss),t(Et),t(Qs),t(E),t(Ls),t(Gt),t(Fs),t(Ht),t(qs),t(Vt),t(Ps),t(X),t(Ys),t(Qt),t(Os),t(Lt),t(Ds),t(Ft),t(Ks),t(qt),t(ea),t(Pt),t(ta),t(G),t(la),t(Ot),t(na),t(H),t(sa),t(Kt),t(aa),t(oa),t(V),t(ia),t(ll),t(ra),t(pa),t(S),t(ca),t(al),t(ua),t(da),t(il),t(ma),t(rl),t(ha),t(pl),t(fa),t(Q),t(Ma),t(ul),t(ya),t(L),t(ga),t(ml),t(va),t(hl),t(ba),t(F),t(wa),t(Ml),t(ja),t(Ta),t(gl),t(Ca),t(vl),t(Ua),t($a),t(wl),t(Ja),t(za),t(Tl),t(xa),t(Cl),t(_a),t(mn)),t(p),v(b),v(je),v(_e),v(ke,e),v(Ie,e),v(Ae,e),v(Re,e),v(Ge,e),v(Ve,e),v(Qe,e),v(Y,e),v(Fe),v(Oe,e),v(Ke,e),v(tt,e),v(D,e),v(nt),v(it),v(te,e),v(ut,e),v(le,e),v(ht,e),v(Mt,e),v(gt,e),v(bt,e),v(ne,e),v(wt),v(Tt,e),v(Ut,e),v(ae,e),v($t),v(zt,e),v(_t),v(It),v(pe,e),v(Xt),v(St),v(Yt),v(Dt),v(el,e),v(tl),v(nl,e),v(sl),v(ol,e),v(cl),v(dl),v(fl),v(yl,e),v(bl,e),v(jl,e)}}}const Fr={local:"esporta-modelli-transformers",sections:[{local:"onnx",sections:[{local:"esportazione-di-un-modello-in-onnx",title:"Esportazione di un modello in ONNX"},{local:"selezione-delle-caratteristiche-per-diverse-topologie-di-modello",title:"Selezione delle caratteristiche per diverse topologie di modello"},{local:"esportazione-di-un-modello-per-unarchitettura-non-supportata",sections:[{local:"implementazione-di-una-configurazione-onnx-personalizzata",title:"Implementazione di una configurazione ONNX personalizzata"},{local:"esportazione-del-modello",title:"Esportazione del modello"},{local:"convalida-degli-output-del-modello",title:"Convalida degli output del modello"}],title:"Esportazione di un modello per un'architettura non supportata"},{local:"contribuire-con-una-nuova-configurazione-a-transformers",title:"Contribuire con una nuova configurazione a 🤗 Transformers"}],title:"ONNX"},{local:"torchscript",sections:[{local:"flag-torchscript-e-pesi-legati",title:"Flag TorchScript e pesi legati"},{local:"input-fittizi-e-standard-lengths",title:"Input fittizi e standard lengths"},{local:"usare-torchsscript-in-python",sections:[{local:"salvare-un-modello",title:"Salvare un modello"},{local:"caricare-un-modello",title:"Caricare un modello"},{local:"utilizzare-un-modello-tracciato-per-linferenza",title:"Utilizzare un modello tracciato per l'inferenza"},{local:"implicazioni",title:"Implicazioni"},{local:"dipendenze",title:"Dipendenze"},{local:"convertire-un-modello-per-aws-neuron",title:"Convertire un modello per AWS Neuron"}],title:"Usare TorchSscript in Python"}],title:"TorchScript"}],title:"Esporta modelli 🤗 Transformers "};function qr($){return Zr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tp extends kr{constructor(p){super(),Wr(this,p,qr,Lr,_r,{})}}export{tp as component};
