import{s as ht,n as ut,o as dt}from"../chunks/scheduler.36a0863c.js";import{S as ft,i as mt,g as a,s as o,u as Z,A as vt,h as l,f as t,c as r,j as c,v as j,y as h,k as s,o as p,a as n,w as W,d as Q,t as Y,x as D}from"../chunks/index.d0f7a4c4.js";import{I as le}from"../chunks/IconCopyLink.bc5fad79.js";import{C as xt}from"../chunks/CodeBlock.69433f87.js";function _t(Se){let u,oe,O,re,d,_,K,$,Ie,G,Ne="Addestramento efficiente su CPU",se,b,Ve="Questa guida si concentra su come addestrare in maniera efficiente grandi modelli su CPU.",pe,f,g,ee,y,Xe,q,Be="Mixed precision con IPEX",ce,z,Ge="IPEX è ottimizzato per CPU con AVX-512 o superiore, e funziona per le CPU con solo AVX2. Pertanto, si prevede che le prestazioni saranno più vantaggiose per le le CPU Intel con AVX-512 o superiori, mentre le CPU con solo AVX2 (ad esempio, le CPU AMD o le CPU Intel più vecchie) potrebbero ottenere prestazioni migliori con IPEX, ma non sono garantite. IPEX offre ottimizzazioni delle prestazioni per l’addestramento della CPU sia con Float32 che con BFloat16. L’uso di BFloat16 è l’argomento principale delle seguenti sezioni.",he,E,qe="Il tipo di dati a bassa precisione BFloat16 è stato supportato in modo nativo su 3rd Generation Xeon® Scalable Processors (aka Cooper Lake) con AVX512 e sarà supportata dalla prossima generazione di Intel® Xeon® Scalable Processors con Intel® Advanced Matrix Extensions (Intel® AMX) instruction set con prestazioni ulteriormente migliorate. L’Auto Mixed Precision per il backende della CPU è stato abilitato da PyTorch-1.10. allo stesso tempo, il supporto di Auto Mixed Precision con BFloat16 per CPU e l’ottimizzazione degli operatori BFloat16 è stata abilitata in modo massiccio in Intel® Extension per PyTorch, and parzialmente aggiornato al branch master di PyTorch. Gli utenti possono ottenere prestazioni migliori ed users experience con IPEX Auto Mixed Precision..",ue,A,Fe='Vedi informazioni più dettagliate su <a href="https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/amp.html" rel="nofollow">Auto Mixed Precision</a>.',de,m,P,te,M,He,F,Re="Installazione di IPEX:",fe,T,Je="Il rilascio di IPEX segue quello di PyTorch, da installare via pip:",me,k,Ze='<thead><tr><th align="center">PyTorch Version</th> <th align="center">IPEX version</th></tr></thead> <tbody><tr><td align="center">1.13</td> <td align="center">1.13.0+cpu</td></tr> <tr><td align="center">1.12</td> <td align="center">1.12.300+cpu</td></tr> <tr><td align="center">1.11</td> <td align="center">1.11.200+cpu</td></tr> <tr><td align="center">1.10</td> <td align="center">1.10.100+cpu</td></tr></tbody>',ve,I,xe,X,je='Vedi altri approcci per <a href="https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/installation.html" rel="nofollow">IPEX installation</a>.',_e,v,C,ie,H,Le,R,We="Utilizzo nel Trainer",ge,L,Qe="Per abilitare la auto mixed precision con IPEX in Trainer, l’utende dovrebbe aggiungere <code>use_ipex</code>, <code>bf16</code> e <code>no_cuda</code> negli argomenti del comando di addestramento.",Pe,U,Ye='Vedi un sempio di un caso d’uso <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering" rel="nofollow">Transformers question-answering</a>',Ce,S,De="<li>Training with IPEX using BF16 auto mixed precision on CPU:</li>",we,N,Oe=` python run_qa.py \\
--model_name_or_path bert-base-uncased \\
--dataset_name squad \\
--do_train \\
--do_eval \\
--per_device_train_batch_size 12 \\
--learning_rate 3e-5 \\
--num_train_epochs 2 \\
--max_seq_length 384 \\
--doc_stride 128 \\
--output_dir /tmp/debug_squad/ \\
<b>--use_ipex \\</b>
<b>--bf16 --no_cuda</b>`,$e,x,w,ne,V,Ue,J,Ke="Esempi pratici",be,B,et='Blog: <a href="https://huggingface.co/blog/intel-sapphire-rapids" rel="nofollow">Accelerating PyTorch Transformers with Intel Sapphire Rapids</a>',ye,ae,ze;return $=new le({}),y=new le({}),M=new le({}),I=new xt({props:{code:"cGlwJTIwaW5zdGFsbCUyMGludGVsX2V4dGVuc2lvbl9mb3JfcHl0b3JjaCUzRCUzRCUzQ3ZlcnNpb25fbmFtZSUzRSUyMC1mJTIwaHR0cHMlM0ElMkYlMkZkZXZlbG9wZXIuaW50ZWwuY29tJTJGaXBleC13aGwtc3RhYmxlLWNwdQ==",highlighted:"pip install intel_extension_for_pytorch==&lt;version_name&gt; -f https://developer.intel.com/ipex-whl-stable-cpu"}}),H=new le({}),V=new le({}),{c(){u=a("meta"),oe=o(),O=a("p"),re=o(),d=a("h1"),_=a("a"),K=a("span"),Z($.$$.fragment),Ie=o(),G=a("span"),G.textContent=Ne,se=o(),b=a("p"),b.textContent=Ve,pe=o(),f=a("h2"),g=a("a"),ee=a("span"),Z(y.$$.fragment),Xe=o(),q=a("span"),q.textContent=Be,ce=o(),z=a("p"),z.textContent=Ge,he=o(),E=a("p"),E.textContent=qe,ue=o(),A=a("p"),A.innerHTML=Fe,de=o(),m=a("h3"),P=a("a"),te=a("span"),Z(M.$$.fragment),He=o(),F=a("span"),F.textContent=Re,fe=o(),T=a("p"),T.textContent=Je,me=o(),k=a("table"),k.innerHTML=Ze,ve=o(),Z(I.$$.fragment),xe=o(),X=a("p"),X.innerHTML=je,_e=o(),v=a("h3"),C=a("a"),ie=a("span"),Z(H.$$.fragment),Le=o(),R=a("span"),R.textContent=We,ge=o(),L=a("p"),L.innerHTML=Qe,Pe=o(),U=a("p"),U.innerHTML=Ye,Ce=o(),S=a("ul"),S.innerHTML=De,we=o(),N=a("pre"),N.innerHTML=Oe,$e=o(),x=a("h3"),w=a("a"),ne=a("span"),Z(V.$$.fragment),Ue=o(),J=a("span"),J.textContent=Ke,be=o(),B=a("p"),B.innerHTML=et,ye=o(),ae=a("p"),this.h()},l(e){const i=vt("svelte-1phssyn",document.head);u=l(i,"META",{name:!0,content:!0}),i.forEach(t),oe=r(e),O=l(e,"P",{}),c(O).forEach(t),re=r(e),d=l(e,"H1",{class:!0});var Ee=c(d);_=l(Ee,"A",{id:!0,class:!0,href:!0});var tt=c(_);K=l(tt,"SPAN",{});var it=c(K);j($.$$.fragment,it),it.forEach(t),tt.forEach(t),Ie=r(Ee),G=l(Ee,"SPAN",{"data-svelte-h":!0}),h(G)!=="svelte-15p2mmy"&&(G.textContent=Ne),Ee.forEach(t),se=r(e),b=l(e,"P",{"data-svelte-h":!0}),h(b)!=="svelte-uyppuu"&&(b.textContent=Ve),pe=r(e),f=l(e,"H2",{class:!0});var Ae=c(f);g=l(Ae,"A",{id:!0,class:!0,href:!0});var nt=c(g);ee=l(nt,"SPAN",{});var at=c(ee);j(y.$$.fragment,at),at.forEach(t),nt.forEach(t),Xe=r(Ae),q=l(Ae,"SPAN",{"data-svelte-h":!0}),h(q)!=="svelte-84k3nu"&&(q.textContent=Be),Ae.forEach(t),ce=r(e),z=l(e,"P",{"data-svelte-h":!0}),h(z)!=="svelte-1kpslxw"&&(z.textContent=Ge),he=r(e),E=l(e,"P",{"data-svelte-h":!0}),h(E)!=="svelte-uzxkpk"&&(E.textContent=qe),ue=r(e),A=l(e,"P",{"data-svelte-h":!0}),h(A)!=="svelte-n2t196"&&(A.innerHTML=Fe),de=r(e),m=l(e,"H3",{class:!0});var Me=c(m);P=l(Me,"A",{id:!0,class:!0,href:!0});var lt=c(P);te=l(lt,"SPAN",{});var ot=c(te);j(M.$$.fragment,ot),ot.forEach(t),lt.forEach(t),He=r(Me),F=l(Me,"SPAN",{"data-svelte-h":!0}),h(F)!=="svelte-1sagcyf"&&(F.textContent=Re),Me.forEach(t),fe=r(e),T=l(e,"P",{"data-svelte-h":!0}),h(T)!=="svelte-hyexng"&&(T.textContent=Je),me=r(e),k=l(e,"TABLE",{"data-svelte-h":!0}),h(k)!=="svelte-okkx16"&&(k.innerHTML=Ze),ve=r(e),j(I.$$.fragment,e),xe=r(e),X=l(e,"P",{"data-svelte-h":!0}),h(X)!=="svelte-yqjm2f"&&(X.innerHTML=je),_e=r(e),v=l(e,"H3",{class:!0});var Te=c(v);C=l(Te,"A",{id:!0,class:!0,href:!0});var rt=c(C);ie=l(rt,"SPAN",{});var st=c(ie);j(H.$$.fragment,st),st.forEach(t),rt.forEach(t),Le=r(Te),R=l(Te,"SPAN",{"data-svelte-h":!0}),h(R)!=="svelte-6cpr5z"&&(R.textContent=We),Te.forEach(t),ge=r(e),L=l(e,"P",{"data-svelte-h":!0}),h(L)!=="svelte-1ldgg7n"&&(L.innerHTML=Qe),Pe=r(e),U=l(e,"P",{"data-svelte-h":!0}),h(U)!=="svelte-pr9u3e"&&(U.innerHTML=Ye),Ce=r(e),S=l(e,"UL",{"data-svelte-h":!0}),h(S)!=="svelte-gvsghn"&&(S.innerHTML=De),we=r(e),N=l(e,"PRE",{"data-svelte-h":!0}),h(N)!=="svelte-195j61d"&&(N.innerHTML=Oe),$e=r(e),x=l(e,"H3",{class:!0});var ke=c(x);w=l(ke,"A",{id:!0,class:!0,href:!0});var pt=c(w);ne=l(pt,"SPAN",{});var ct=c(ne);j(V.$$.fragment,ct),ct.forEach(t),pt.forEach(t),Ue=r(ke),J=l(ke,"SPAN",{"data-svelte-h":!0}),h(J)!=="svelte-gpi8hw"&&(J.textContent=Ke),ke.forEach(t),be=r(e),B=l(e,"P",{"data-svelte-h":!0}),h(B)!=="svelte-w7zs5j"&&(B.innerHTML=et),ye=r(e),ae=l(e,"P",{}),c(ae).forEach(t),this.h()},h(){s(u,"name","hf:doc:metadata"),s(u,"content",JSON.stringify(gt)),s(_,"id","addestramento-efficiente-su-cpu"),s(_,"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"),s(_,"href","#addestramento-efficiente-su-cpu"),s(d,"class","relative group"),s(g,"id","mixed-precision-con-ipex"),s(g,"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"),s(g,"href","#mixed-precision-con-ipex"),s(f,"class","relative group"),s(P,"id","installazione-di-ipex"),s(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"),s(P,"href","#installazione-di-ipex"),s(m,"class","relative group"),s(C,"id","utilizzo-nel-trainer"),s(C,"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"),s(C,"href","#utilizzo-nel-trainer"),s(v,"class","relative group"),s(w,"id","esempi-pratici"),s(w,"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"),s(w,"href","#esempi-pratici"),s(x,"class","relative group")},m(e,i){p(document.head,u),n(e,oe,i),n(e,O,i),n(e,re,i),n(e,d,i),p(d,_),p(_,K),W($,K,null),p(d,Ie),p(d,G),n(e,se,i),n(e,b,i),n(e,pe,i),n(e,f,i),p(f,g),p(g,ee),W(y,ee,null),p(f,Xe),p(f,q),n(e,ce,i),n(e,z,i),n(e,he,i),n(e,E,i),n(e,ue,i),n(e,A,i),n(e,de,i),n(e,m,i),p(m,P),p(P,te),W(M,te,null),p(m,He),p(m,F),n(e,fe,i),n(e,T,i),n(e,me,i),n(e,k,i),n(e,ve,i),W(I,e,i),n(e,xe,i),n(e,X,i),n(e,_e,i),n(e,v,i),p(v,C),p(C,ie),W(H,ie,null),p(v,Le),p(v,R),n(e,ge,i),n(e,L,i),n(e,Pe,i),n(e,U,i),n(e,Ce,i),n(e,S,i),n(e,we,i),n(e,N,i),n(e,$e,i),n(e,x,i),p(x,w),p(w,ne),W(V,ne,null),p(x,Ue),p(x,J),n(e,be,i),n(e,B,i),n(e,ye,i),n(e,ae,i),ze=!0},p:ut,i(e){ze||(Q($.$$.fragment,e),Q(y.$$.fragment,e),Q(M.$$.fragment,e),Q(I.$$.fragment,e),Q(H.$$.fragment,e),Q(V.$$.fragment,e),ze=!0)},o(e){Y($.$$.fragment,e),Y(y.$$.fragment,e),Y(M.$$.fragment,e),Y(I.$$.fragment,e),Y(H.$$.fragment,e),Y(V.$$.fragment,e),ze=!1},d(e){e&&(t(oe),t(O),t(re),t(d),t(se),t(b),t(pe),t(f),t(ce),t(z),t(he),t(E),t(ue),t(A),t(de),t(m),t(fe),t(T),t(me),t(k),t(ve),t(xe),t(X),t(_e),t(v),t(ge),t(L),t(Pe),t(U),t(Ce),t(S),t(we),t(N),t($e),t(x),t(be),t(B),t(ye),t(ae)),t(u),D($),D(y),D(M),D(I,e),D(H),D(V)}}}const gt={local:"addestramento-efficiente-su-cpu",sections:[{local:"mixed-precision-con-ipex",sections:[{local:"installazione-di-ipex",title:"Installazione di IPEX:"},{local:"utilizzo-nel-trainer",title:"Utilizzo nel Trainer"},{local:"esempi-pratici",title:"Esempi pratici"}],title:"Mixed precision con IPEX"}],title:"Addestramento efficiente su CPU"};function Pt(Se){return dt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yt extends ft{constructor(u){super(),mt(this,u,Pt,_t,ht,{})}}export{yt as component};
