import{S as Qe,i as We,s as Xe,e as n,k as m,w as B,t as r,M as Ze,c as a,d as t,m as c,a as i,x as G,h as p,b as s,G as o,g as f,y as U,L as et,q as J,o as z,B as F,v as tt}from"../../chunks/vendor-hf-doc-builder.js";import{I as De}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as Ke}from"../../chunks/CodeBlock-hf-doc-builder.js";function ot(xe){let d,K,v,O,q,g,pe,T,fe,Q,h,ue,E,me,ce,S,he,de,W,w,$,j,P,ve,C,we,X,x,_e,Z,N,ee,_,y,H,V,Oe,R,$e,te,u,ye,Y,be,Ie,L,ge,Ee,M,Se,Pe,oe,k,ne,b,Ne,D,Ve,ke,ae;return g=new De({}),P=new De({}),N=new Ke({props:{code:'pip install optimum["openvino"]',highlighted:'pip <span class="hljs-keyword">install</span> optimum[<span class="hljs-string">&quot;openvino&quot;</span>]'}}),V=new De({}),k=new Ke({props:{code:`from optimum.intel.openvino import OVStableDiffusionPipeline

model_id = "runwayml/stable-diffusion-v1-5"
pipe = OVStableDiffusionPipeline.from_pretrained(model_id, export=True)
prompt = "a photo of an astronaut riding a horse on mars"
images = pipe(prompt).images[0]`,highlighted:`<span class="hljs-keyword">from</span> optimum.intel.openvino <span class="hljs-keyword">import</span> OVStableDiffusionPipeline

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = OVStableDiffusionPipeline.from_pretrained(model_id, export=<span class="hljs-literal">True</span>)
prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
images = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){d=n("meta"),K=m(),v=n("h1"),O=n("a"),q=n("span"),B(g.$$.fragment),pe=m(),T=n("span"),fe=r("How to use OpenVINO for inference"),Q=m(),h=n("p"),ue=r("\u{1F917} "),E=n("a"),me=r("Optimum"),ce=r(" provides a Stable Diffusion pipeline compatible with OpenVINO. You can now easily perform inference with OpenVINO Runtime on a variety of Intel processors ("),S=n("a"),he=r("see"),de=r(" the full list of supported devices)."),W=m(),w=n("h2"),$=n("a"),j=n("span"),B(P.$$.fragment),ve=m(),C=n("span"),we=r("Installation"),X=m(),x=n("p"),_e=r("Install \u{1F917} Optimum Intel with the following command:"),Z=m(),B(N.$$.fragment),ee=m(),_=n("h2"),y=n("a"),H=n("span"),B(V.$$.fragment),Oe=m(),R=n("span"),$e=r("Stable Diffusion Inference"),te=m(),u=n("p"),ye=r("To load an OpenVINO model and run inference with OpenVINO Runtime, you need to replace "),Y=n("code"),be=r("StableDiffusionPipeline"),Ie=r(" with "),L=n("code"),ge=r("OVStableDiffusionPipeline"),Ee=r(". In case you want to load a PyTorch model and convert it to the OpenVINO format on-the-fly, you can set "),M=n("code"),Se=r("export=True"),Pe=r("."),oe=m(),B(k.$$.fragment),ne=m(),b=n("p"),Ne=r("You can find more examples (such as static reshaping and model compilation) in "),D=n("a"),Ve=r("optimum documentation"),ke=r("."),this.h()},l(e){const l=Ze('[data-svelte="svelte-1phssyn"]',document.head);d=a(l,"META",{name:!0,content:!0}),l.forEach(t),K=c(e),v=a(e,"H1",{class:!0});var ie=i(v);O=a(ie,"A",{id:!0,class:!0,href:!0});var Ae=i(O);q=a(Ae,"SPAN",{});var qe=i(q);G(g.$$.fragment,qe),qe.forEach(t),Ae.forEach(t),pe=c(ie),T=a(ie,"SPAN",{});var Te=i(T);fe=p(Te,"How to use OpenVINO for inference"),Te.forEach(t),ie.forEach(t),Q=c(e),h=a(e,"P",{});var A=i(h);ue=p(A,"\u{1F917} "),E=a(A,"A",{href:!0,rel:!0});var je=i(E);me=p(je,"Optimum"),je.forEach(t),ce=p(A," provides a Stable Diffusion pipeline compatible with OpenVINO. You can now easily perform inference with OpenVINO Runtime on a variety of Intel processors ("),S=a(A,"A",{href:!0,rel:!0});var Ce=i(S);he=p(Ce,"see"),Ce.forEach(t),de=p(A," the full list of supported devices)."),A.forEach(t),W=c(e),w=a(e,"H2",{class:!0});var le=i(w);$=a(le,"A",{id:!0,class:!0,href:!0});var He=i($);j=a(He,"SPAN",{});var Re=i(j);G(P.$$.fragment,Re),Re.forEach(t),He.forEach(t),ve=c(le),C=a(le,"SPAN",{});var Ye=i(C);we=p(Ye,"Installation"),Ye.forEach(t),le.forEach(t),X=c(e),x=a(e,"P",{});var Le=i(x);_e=p(Le,"Install \u{1F917} Optimum Intel with the following command:"),Le.forEach(t),Z=c(e),G(N.$$.fragment,e),ee=c(e),_=a(e,"H2",{class:!0});var se=i(_);y=a(se,"A",{id:!0,class:!0,href:!0});var Me=i(y);H=a(Me,"SPAN",{});var Be=i(H);G(V.$$.fragment,Be),Be.forEach(t),Me.forEach(t),Oe=c(se),R=a(se,"SPAN",{});var Ge=i(R);$e=p(Ge,"Stable Diffusion Inference"),Ge.forEach(t),se.forEach(t),te=c(e),u=a(e,"P",{});var I=i(u);ye=p(I,"To load an OpenVINO model and run inference with OpenVINO Runtime, you need to replace "),Y=a(I,"CODE",{});var Ue=i(Y);be=p(Ue,"StableDiffusionPipeline"),Ue.forEach(t),Ie=p(I," with "),L=a(I,"CODE",{});var Je=i(L);ge=p(Je,"OVStableDiffusionPipeline"),Je.forEach(t),Ee=p(I,". In case you want to load a PyTorch model and convert it to the OpenVINO format on-the-fly, you can set "),M=a(I,"CODE",{});var ze=i(M);Se=p(ze,"export=True"),ze.forEach(t),Pe=p(I,"."),I.forEach(t),oe=c(e),G(k.$$.fragment,e),ne=c(e),b=a(e,"P",{});var re=i(b);Ne=p(re,"You can find more examples (such as static reshaping and model compilation) in "),D=a(re,"A",{href:!0,rel:!0});var Fe=i(D);Ve=p(Fe,"optimum documentation"),Fe.forEach(t),ke=p(re,"."),re.forEach(t),this.h()},h(){s(d,"name","hf:doc:metadata"),s(d,"content",JSON.stringify(nt)),s(O,"id","how-to-use-openvino-for-inference"),s(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"),s(O,"href","#how-to-use-openvino-for-inference"),s(v,"class","relative group"),s(E,"href","https://github.com/huggingface/optimum-intel"),s(E,"rel","nofollow"),s(S,"href","https://docs.openvino.ai/latest/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html"),s(S,"rel","nofollow"),s($,"id","installation"),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","#installation"),s(w,"class","relative group"),s(y,"id","stable-diffusion-inference"),s(y,"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(y,"href","#stable-diffusion-inference"),s(_,"class","relative group"),s(D,"href","https://huggingface.co/docs/optimum/intel/inference#export-and-inference-of-stable-diffusion-models"),s(D,"rel","nofollow")},m(e,l){o(document.head,d),f(e,K,l),f(e,v,l),o(v,O),o(O,q),U(g,q,null),o(v,pe),o(v,T),o(T,fe),f(e,Q,l),f(e,h,l),o(h,ue),o(h,E),o(E,me),o(h,ce),o(h,S),o(S,he),o(h,de),f(e,W,l),f(e,w,l),o(w,$),o($,j),U(P,j,null),o(w,ve),o(w,C),o(C,we),f(e,X,l),f(e,x,l),o(x,_e),f(e,Z,l),U(N,e,l),f(e,ee,l),f(e,_,l),o(_,y),o(y,H),U(V,H,null),o(_,Oe),o(_,R),o(R,$e),f(e,te,l),f(e,u,l),o(u,ye),o(u,Y),o(Y,be),o(u,Ie),o(u,L),o(L,ge),o(u,Ee),o(u,M),o(M,Se),o(u,Pe),f(e,oe,l),U(k,e,l),f(e,ne,l),f(e,b,l),o(b,Ne),o(b,D),o(D,Ve),o(b,ke),ae=!0},p:et,i(e){ae||(J(g.$$.fragment,e),J(P.$$.fragment,e),J(N.$$.fragment,e),J(V.$$.fragment,e),J(k.$$.fragment,e),ae=!0)},o(e){z(g.$$.fragment,e),z(P.$$.fragment,e),z(N.$$.fragment,e),z(V.$$.fragment,e),z(k.$$.fragment,e),ae=!1},d(e){t(d),e&&t(K),e&&t(v),F(g),e&&t(Q),e&&t(h),e&&t(W),e&&t(w),F(P),e&&t(X),e&&t(x),e&&t(Z),F(N,e),e&&t(ee),e&&t(_),F(V),e&&t(te),e&&t(u),e&&t(oe),F(k,e),e&&t(ne),e&&t(b)}}}const nt={local:"how-to-use-openvino-for-inference",sections:[{local:"installation",title:"Installation"},{local:"stable-diffusion-inference",title:"Stable Diffusion Inference"}],title:"How to use OpenVINO for inference"};function at(xe){return tt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends Qe{constructor(d){super();We(this,d,at,ot,Xe,{})}}export{rt as default,nt as metadata};
