import{s as Ie,o as ye,n as Le}from"../chunks/scheduler.36a0863c.js";import{S as je,i as Me,g as r,s as o,r as $,A as He,h as l,f as i,c as a,j as Ce,u as g,x as p,k as we,y as Ee,a as n,v as _,d as T,t as v,w as z}from"../chunks/index.9c13489a.js";import{T as qe}from"../chunks/Tip.3b06990e.js";import{H as G,E as Se}from"../chunks/EditOnGithub.e88f2b7b.js";function Ue(B){let s,x="per PyTorch >= 1.14.0. JIT-mode potrebe giovare a qualsiasi modello di prediction e evaluaion visto che il dict input è supportato in jit.trace",d,u,c=`per PyTorch < 1.14.0. JIT-mode potrebbe giovare ai modelli il cui ordine dei parametri corrisponde all’ordine delle tuple in ingresso in jit.trace, come i modelli per question-answering.
Nel caso in cui l’ordine dei parametri seguenti non corrisponda all’ordine delle tuple in ingresso in jit.trace, come nei modelli di text-classification, jit.trace fallirà e lo cattureremo con una eccezione al fine di renderlo un fallback. Il logging è usato per notificare gli utenti.`;return{c(){s=r("p"),s.textContent=x,d=o(),u=r("p"),u.textContent=c},l(m){s=l(m,"P",{"data-svelte-h":!0}),p(s)!=="svelte-1ukl5we"&&(s.textContent=x),d=a(m),u=l(m,"P",{"data-svelte-h":!0}),p(u)!=="svelte-1ajwizk"&&(u.textContent=c)},m(m,f){n(m,s,f),n(m,d,f),n(m,u,f)},p:Le,d(m){m&&(i(s),i(d),i(u))}}}function Je(B){let s,x,d,u,c,m,f,ue="Questa guida si concentra sull’inferenza di modelli di grandi dimensioni in modo efficiente sulla CPU.",N,P,R,b,fe='Abbiamo integrato di recente <code>BetterTransformer</code> per fare inferenza più rapidamente con modelli per testi, immagini e audio. Visualizza la documentazione sull’integrazione <a href="https://huggingface.co/docs/optimum/bettertransformer/overview" rel="nofollow">qui</a> per maggiori dettagli.',F,C,Q,w,de=`TorchScript è un modo di creare modelli serializzabili e ottimizzabili da codice PyTorch. Ogni programmma TorchScript può esere salvato da un processo Python  e caricato in un processo dove non ci sono dipendenze Python.
Comparandolo con l’eager mode di default, jit mode in PyTorch normalmente fornisce prestazioni migliori per l’inferenza del modello da parte di metodologie di ottimizzazione come la operator fusion.`,V,I,ce='Per una prima introduzione a TorchScript, vedi la Introduction to <a href="https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html#tracing-modules" rel="nofollow">PyTorch TorchScript tutorial</a>.',D,y,K,L,he="Intel® Extension per PyTorch fornnisce ulteriori ottimizzazioni in jit mode per i modelli della serie Transformers. Consigliamo vivamente agli utenti di usufruire dei vantaggi di Intel® Extension per PyTorch con jit mode. Alcuni operator patterns usati fequentemente dai modelli Transformers models sono già supportati in Intel® Extension per PyTorch con jit mode fusions. Questi fusion patterns come Multi-head-attention fusion, Concat Linear, Linear+Add, Linear+Gelu, Add+LayerNorm fusion and etc. sono abilitati e hanno buone performance. I benefici della fusion è fornito agli utenti in modo trasparente. In base alle analisi, il ~70% dei problemi più popolari in NLP question-answering, text-classification, and token-classification possono avere benefici sulle performance grazie ai fusion patterns sia per Float32 precision che per BFloat16 Mixed precision.",W,j,$e='Vedi maggiori informazioni per <a href="https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/graph_optimization.html" rel="nofollow">IPEX Graph Optimization</a>.',Y,M,Z,H,ge='I rilasci di IPEX seguono PyTorch, verifica i vari approcci per <a href="https://intel.github.io/intel-extension-for-pytorch/" rel="nofollow">IPEX installation</a>.',ee,E,te,q,_e="Per abilitare JIT-mode in Trainer per evaluation e prediction, devi aggiungere <code>jit_mode_eval</code> negli argomenti di Trainer.",ie,h,ne,S,Te='Trovi un esempo con caso d’uso in <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering" rel="nofollow">Transformers question-answering</a>',oe,U,ve="<li>Inference using jit mode on CPU:</li>",ae,J,ze=`python run_qa.py \\
--model_name_or_path csarron/bert-base-uncased-squad-v1 \\
--dataset_name squad \\
--do_eval \\
--max_seq_length 384 \\
--doc_stride 128 \\
--output_dir /tmp/ \\
--no_cuda \\
<b>--jit_mode_eval </b>`,re,X,xe="<li>Inference with IPEX using jit mode on CPU:</li>",le,A,Pe=`python run_qa.py \\
--model_name_or_path csarron/bert-base-uncased-squad-v1 \\
--dataset_name squad \\
--do_eval \\
--max_seq_length 384 \\
--doc_stride 128 \\
--output_dir /tmp/ \\
--no_cuda \\
<b>--use_ipex \\</b>
<b>--jit_mode_eval</b>`,se,k,pe,O,me;return c=new G({props:{title:"Inferenza Efficiente su CPU",local:"inferenza-efficiente-su-cpu",headingTag:"h1"}}),P=new G({props:{title:"BetterTransformer per inferenza più rapida",local:"bettertransformer-per-inferenza-più-rapida",headingTag:"h2"}}),C=new G({props:{title:"PyTorch JIT-mode (TorchScript)",local:"pytorch-jit-mode-torchscript",headingTag:"h2"}}),y=new G({props:{title:"IPEX Graph Optimization con JIT-mode",local:"ipex-graph-optimization-con-jit-mode",headingTag:"h3"}}),M=new G({props:{title:"Installazione di IPEX",local:"installazione-di-ipex",headingTag:"h4"}}),E=new G({props:{title:"Utilizzo del JIT-mode",local:"utilizzo-del-jit-mode",headingTag:"h3"}}),h=new qe({props:{warning:!0,$$slots:{default:[Ue]},$$scope:{ctx:B}}}),k=new Se({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/it/perf_infer_cpu.md"}}),{c(){s=r("meta"),x=o(),d=r("p"),u=o(),$(c.$$.fragment),m=o(),f=r("p"),f.textContent=ue,N=o(),$(P.$$.fragment),R=o(),b=r("p"),b.innerHTML=fe,F=o(),$(C.$$.fragment),Q=o(),w=r("p"),w.textContent=de,V=o(),I=r("p"),I.innerHTML=ce,D=o(),$(y.$$.fragment),K=o(),L=r("p"),L.textContent=he,W=o(),j=r("p"),j.innerHTML=$e,Y=o(),$(M.$$.fragment),Z=o(),H=r("p"),H.innerHTML=ge,ee=o(),$(E.$$.fragment),te=o(),q=r("p"),q.innerHTML=_e,ie=o(),$(h.$$.fragment),ne=o(),S=r("p"),S.innerHTML=Te,oe=o(),U=r("ul"),U.innerHTML=ve,ae=o(),J=r("pre"),J.innerHTML=ze,re=o(),X=r("ul"),X.innerHTML=xe,le=o(),A=r("pre"),A.innerHTML=Pe,se=o(),$(k.$$.fragment),pe=o(),O=r("p"),this.h()},l(e){const t=He("svelte-u9bgzb",document.head);s=l(t,"META",{name:!0,content:!0}),t.forEach(i),x=a(e),d=l(e,"P",{}),Ce(d).forEach(i),u=a(e),g(c.$$.fragment,e),m=a(e),f=l(e,"P",{"data-svelte-h":!0}),p(f)!=="svelte-qu0j64"&&(f.textContent=ue),N=a(e),g(P.$$.fragment,e),R=a(e),b=l(e,"P",{"data-svelte-h":!0}),p(b)!=="svelte-67xobp"&&(b.innerHTML=fe),F=a(e),g(C.$$.fragment,e),Q=a(e),w=l(e,"P",{"data-svelte-h":!0}),p(w)!=="svelte-3muwsh"&&(w.textContent=de),V=a(e),I=l(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-6flq5m"&&(I.innerHTML=ce),D=a(e),g(y.$$.fragment,e),K=a(e),L=l(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-1p2d5pw"&&(L.textContent=he),W=a(e),j=l(e,"P",{"data-svelte-h":!0}),p(j)!=="svelte-1e9vei1"&&(j.innerHTML=$e),Y=a(e),g(M.$$.fragment,e),Z=a(e),H=l(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1cbxjdx"&&(H.innerHTML=ge),ee=a(e),g(E.$$.fragment,e),te=a(e),q=l(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-y6f70"&&(q.innerHTML=_e),ie=a(e),g(h.$$.fragment,e),ne=a(e),S=l(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-ibdywp"&&(S.innerHTML=Te),oe=a(e),U=l(e,"UL",{"data-svelte-h":!0}),p(U)!=="svelte-xwyqaf"&&(U.innerHTML=ve),ae=a(e),J=l(e,"PRE",{"data-svelte-h":!0}),p(J)!=="svelte-gw81i0"&&(J.innerHTML=ze),re=a(e),X=l(e,"UL",{"data-svelte-h":!0}),p(X)!=="svelte-prijpn"&&(X.innerHTML=xe),le=a(e),A=l(e,"PRE",{"data-svelte-h":!0}),p(A)!=="svelte-18ss6jb"&&(A.innerHTML=Pe),se=a(e),g(k.$$.fragment,e),pe=a(e),O=l(e,"P",{}),Ce(O).forEach(i),this.h()},h(){we(s,"name","hf:doc:metadata"),we(s,"content",Xe)},m(e,t){Ee(document.head,s),n(e,x,t),n(e,d,t),n(e,u,t),_(c,e,t),n(e,m,t),n(e,f,t),n(e,N,t),_(P,e,t),n(e,R,t),n(e,b,t),n(e,F,t),_(C,e,t),n(e,Q,t),n(e,w,t),n(e,V,t),n(e,I,t),n(e,D,t),_(y,e,t),n(e,K,t),n(e,L,t),n(e,W,t),n(e,j,t),n(e,Y,t),_(M,e,t),n(e,Z,t),n(e,H,t),n(e,ee,t),_(E,e,t),n(e,te,t),n(e,q,t),n(e,ie,t),_(h,e,t),n(e,ne,t),n(e,S,t),n(e,oe,t),n(e,U,t),n(e,ae,t),n(e,J,t),n(e,re,t),n(e,X,t),n(e,le,t),n(e,A,t),n(e,se,t),_(k,e,t),n(e,pe,t),n(e,O,t),me=!0},p(e,[t]){const be={};t&2&&(be.$$scope={dirty:t,ctx:e}),h.$set(be)},i(e){me||(T(c.$$.fragment,e),T(P.$$.fragment,e),T(C.$$.fragment,e),T(y.$$.fragment,e),T(M.$$.fragment,e),T(E.$$.fragment,e),T(h.$$.fragment,e),T(k.$$.fragment,e),me=!0)},o(e){v(c.$$.fragment,e),v(P.$$.fragment,e),v(C.$$.fragment,e),v(y.$$.fragment,e),v(M.$$.fragment,e),v(E.$$.fragment,e),v(h.$$.fragment,e),v(k.$$.fragment,e),me=!1},d(e){e&&(i(x),i(d),i(u),i(m),i(f),i(N),i(R),i(b),i(F),i(Q),i(w),i(V),i(I),i(D),i(K),i(L),i(W),i(j),i(Y),i(Z),i(H),i(ee),i(te),i(q),i(ie),i(ne),i(S),i(oe),i(U),i(ae),i(J),i(re),i(X),i(le),i(A),i(se),i(pe),i(O)),i(s),z(c,e),z(P,e),z(C,e),z(y,e),z(M,e),z(E,e),z(h,e),z(k,e)}}}const Xe='{"title":"Inferenza Efficiente su CPU","local":"inferenza-efficiente-su-cpu","sections":[{"title":"BetterTransformer per inferenza più rapida","local":"bettertransformer-per-inferenza-più-rapida","sections":[],"depth":2},{"title":"PyTorch JIT-mode (TorchScript)","local":"pytorch-jit-mode-torchscript","sections":[{"title":"IPEX Graph Optimization con JIT-mode","local":"ipex-graph-optimization-con-jit-mode","sections":[{"title":"Installazione di IPEX","local":"installazione-di-ipex","sections":[],"depth":4}],"depth":3},{"title":"Utilizzo del JIT-mode","local":"utilizzo-del-jit-mode","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ae(B){return ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ne extends je{constructor(s){super(),Me(this,s,Ae,Je,Ie,{})}}export{Ne as component};
