import{s as Me,n as Te,o as ye}from"../chunks/scheduler.182ea377.js";import{S as Je,i as ge,g as a,s as i,r as u,A as Ue,h as p,f as l,c as s,j as we,u as r,x as o,k as ie,y as We,a as n,v as d,d as h,t as c,w as b}from"../chunks/index.abf12888.js";import{C as ne}from"../chunks/CodeBlock.57fe6e13.js";import{H as se,E as ve}from"../chunks/EditOnGithub.9b8e78e4.js";function $e(ae){let m,X,V,x,w,E,M,pe='🤗 <a href="https://github.com/huggingface/optimum-intel" rel="nofollow">Optimum</a> provides Stable Diffusion pipelines compatible with OpenVINO to perform inference on a variety of Intel processors (see the <a href="https://docs.openvino.ai/latest/openvino_docs_OV_UG_supported_plugins_Supported_Devices.html" rel="nofollow">full list</a> of supported devices).',H,T,oe='You’ll need to install 🤗 Optimum Intel with the <code>--upgrade-strategy eager</code> option to ensure <a href="https://github.com/huggingface/optimum-intel" rel="nofollow"><code>optimum-intel</code></a> is using the latest version:',L,y,Q,J,me="This guide will show you how to use the Stable Diffusion and Stable Diffusion XL (SDXL) pipelines with OpenVINO.",R,g,N,U,fe="To load and run inference, use the <code>OVStableDiffusionPipeline</code>. If you want to load a PyTorch model and convert it to the OpenVINO format on-the-fly, set <code>export=True</code>:",k,W,D,v,ue="To further speed-up inference, statically reshape the model. If you change any parameters such as the outputs height or width, you’ll need to statically reshape your model again.",Y,$,O,f,re='<img src="https://huggingface.co/datasets/optimum/documentation-images/resolve/main/intel/openvino/stable_diffusion_v1_5_sail_boat_rembrandt.png"/>',P,Z,de='You can find more examples in the 🤗 Optimum <a href="https://huggingface.co/docs/optimum/intel/inference#stable-diffusion" rel="nofollow">documentation</a>, and Stable Diffusion is supported for text-to-image, image-to-image, and inpainting.',z,G,F,I,he="To load and run inference with SDXL, use the <code>OVStableDiffusionXLPipeline</code>:",q,j,A,_,ce='To further speed-up inference, <a href="#stable-diffusion">statically reshape</a> the model as shown in the Stable Diffusion section.',K,B,be='You can find more examples in the 🤗 Optimum <a href="https://huggingface.co/docs/optimum/intel/inference#stable-diffusion-xl" rel="nofollow">documentation</a>, and running SDXL in OpenVINO is supported for text-to-image and image-to-image.',ee,S,te,C,le;return w=new se({props:{title:"OpenVINO",local:"openvino",headingTag:"h1"}}),y=new ne({props:{code:"cGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZS1zdHJhdGVneSUyMGVhZ2VyJTIwb3B0aW11bSU1QiUyMm9wZW52aW5vJTIyJTVE",highlighted:'pip install --upgrade-strategy eager optimum[<span class="hljs-string">&quot;openvino&quot;</span>]',wrap:!1}}),g=new se({props:{title:"Stable Diffusion",local:"stable-diffusion",headingTag:"h2"}}),W=new ne({props:{code:"ZnJvbSUyMG9wdGltdW0uaW50ZWwlMjBpbXBvcnQlMjBPVlN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXBpcGVsaW5lJTIwJTNEJTIwT1ZTdGFibGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjBleHBvcnQlM0RUcnVlKSUwQXByb21wdCUyMCUzRCUyMCUyMnNhaWxpbmclMjBzaGlwJTIwaW4lMjBzdG9ybSUyMGJ5JTIwUmVtYnJhbmR0JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQpLmltYWdlcyU1QjAlNUQlMEElMEElMjMlMjBEb24ndCUyMGZvcmdldCUyMHRvJTIwc2F2ZSUyMHRoZSUyMGV4cG9ydGVkJTIwbW9kZWwlMEFwaXBlbGluZS5zYXZlX3ByZXRyYWluZWQoJTIyb3BlbnZpbm8tc2QtdjEtNSUyMik=",highlighted:`<span class="hljs-keyword">from</span> optimum.intel <span class="hljs-keyword">import</span> OVStableDiffusionPipeline

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipeline = OVStableDiffusionPipeline.from_pretrained(model_id, export=<span class="hljs-literal">True</span>)
prompt = <span class="hljs-string">&quot;sailing ship in storm by Rembrandt&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]

<span class="hljs-comment"># Don&#x27;t forget to save the exported model</span>
pipeline.save_pretrained(<span class="hljs-string">&quot;openvino-sd-v1-5&quot;</span>)`,wrap:!1}}),$=new ne({props:{code:"JTIzJTIwRGVmaW5lJTIwdGhlJTIwc2hhcGVzJTIwcmVsYXRlZCUyMHRvJTIwdGhlJTIwaW5wdXRzJTIwYW5kJTIwZGVzaXJlZCUyMG91dHB1dHMlMEFiYXRjaF9zaXplJTJDJTIwbnVtX2ltYWdlcyUyQyUyMGhlaWdodCUyQyUyMHdpZHRoJTIwJTNEJTIwMSUyQyUyMDElMkMlMjA1MTIlMkMlMjA1MTIlMEElMEElMjMlMjBTdGF0aWNhbGx5JTIwcmVzaGFwZSUyMHRoZSUyMG1vZGVsJTBBcGlwZWxpbmUucmVzaGFwZShiYXRjaF9zaXplJTJDJTIwaGVpZ2h0JTJDJTIwd2lkdGglMkMlMjBudW1faW1hZ2VzKSUwQSUyMyUyMENvbXBpbGUlMjB0aGUlMjBtb2RlbCUyMGJlZm9yZSUyMGluZmVyZW5jZSUwQXBpcGVsaW5lLmNvbXBpbGUoKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNEaGVpZ2h0JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0R3aWR0aCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbWFnZXNfcGVyX3Byb21wdCUzRG51bV9pbWFnZXMlMkMlMEEpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-comment"># Define the shapes related to the inputs and desired outputs</span>
batch_size, num_images, height, width = <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">512</span>, <span class="hljs-number">512</span>

<span class="hljs-comment"># Statically reshape the model</span>
pipeline.reshape(batch_size, height, width, num_images)
<span class="hljs-comment"># Compile the model before inference</span>
pipeline.<span class="hljs-built_in">compile</span>()

image = pipeline(
    prompt,
    height=height,
    width=width,
    num_images_per_prompt=num_images,
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),G=new se({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),j=new ne({props:{code:"ZnJvbSUyMG9wdGltdW0uaW50ZWwlMjBpbXBvcnQlMjBPVlN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUwQXBpcGVsaW5lJTIwJTNEJTIwT1ZTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFwcm9tcHQlMjAlM0QlMjAlMjJzYWlsaW5nJTIwc2hpcCUyMGluJTIwc3Rvcm0lMjBieSUyMFJlbWJyYW5kdCUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> optimum.intel <span class="hljs-keyword">import</span> OVStableDiffusionXLPipeline

model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
pipeline = OVStableDiffusionXLPipeline.from_pretrained(model_id)
prompt = <span class="hljs-string">&quot;sailing ship in storm by Rembrandt&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]`,wrap:!1}}),S=new ve({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/optimization/open_vino.md"}}),{c(){m=a("meta"),X=i(),V=a("p"),x=i(),u(w.$$.fragment),E=i(),M=a("p"),M.innerHTML=pe,H=i(),T=a("p"),T.innerHTML=oe,L=i(),u(y.$$.fragment),Q=i(),J=a("p"),J.textContent=me,R=i(),u(g.$$.fragment),N=i(),U=a("p"),U.innerHTML=fe,k=i(),u(W.$$.fragment),D=i(),v=a("p"),v.textContent=ue,Y=i(),u($.$$.fragment),O=i(),f=a("div"),f.innerHTML=re,P=i(),Z=a("p"),Z.innerHTML=de,z=i(),u(G.$$.fragment),F=i(),I=a("p"),I.innerHTML=he,q=i(),u(j.$$.fragment),A=i(),_=a("p"),_.innerHTML=ce,K=i(),B=a("p"),B.innerHTML=be,ee=i(),u(S.$$.fragment),te=i(),C=a("p"),this.h()},l(e){const t=Ue("svelte-u9bgzb",document.head);m=p(t,"META",{name:!0,content:!0}),t.forEach(l),X=s(e),V=p(e,"P",{}),we(V).forEach(l),x=s(e),r(w.$$.fragment,e),E=s(e),M=p(e,"P",{"data-svelte-h":!0}),o(M)!=="svelte-8v4mnh"&&(M.innerHTML=pe),H=s(e),T=p(e,"P",{"data-svelte-h":!0}),o(T)!=="svelte-1yjuyfl"&&(T.innerHTML=oe),L=s(e),r(y.$$.fragment,e),Q=s(e),J=p(e,"P",{"data-svelte-h":!0}),o(J)!=="svelte-rxdhyz"&&(J.textContent=me),R=s(e),r(g.$$.fragment,e),N=s(e),U=p(e,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1150q8r"&&(U.innerHTML=fe),k=s(e),r(W.$$.fragment,e),D=s(e),v=p(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-1pgwlbo"&&(v.textContent=ue),Y=s(e),r($.$$.fragment,e),O=s(e),f=p(e,"DIV",{class:!0,"data-svelte-h":!0}),o(f)!=="svelte-1bbei4i"&&(f.innerHTML=re),P=s(e),Z=p(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-al50pl"&&(Z.innerHTML=de),z=s(e),r(G.$$.fragment,e),F=s(e),I=p(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-1a3vd4r"&&(I.innerHTML=he),q=s(e),r(j.$$.fragment,e),A=s(e),_=p(e,"P",{"data-svelte-h":!0}),o(_)!=="svelte-1ku614i"&&(_.innerHTML=ce),K=s(e),B=p(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-ar6dc6"&&(B.innerHTML=be),ee=s(e),r(S.$$.fragment,e),te=s(e),C=p(e,"P",{}),we(C).forEach(l),this.h()},h(){ie(m,"name","hf:doc:metadata"),ie(m,"content",Ze),ie(f,"class","flex justify-center")},m(e,t){We(document.head,m),n(e,X,t),n(e,V,t),n(e,x,t),d(w,e,t),n(e,E,t),n(e,M,t),n(e,H,t),n(e,T,t),n(e,L,t),d(y,e,t),n(e,Q,t),n(e,J,t),n(e,R,t),d(g,e,t),n(e,N,t),n(e,U,t),n(e,k,t),d(W,e,t),n(e,D,t),n(e,v,t),n(e,Y,t),d($,e,t),n(e,O,t),n(e,f,t),n(e,P,t),n(e,Z,t),n(e,z,t),d(G,e,t),n(e,F,t),n(e,I,t),n(e,q,t),d(j,e,t),n(e,A,t),n(e,_,t),n(e,K,t),n(e,B,t),n(e,ee,t),d(S,e,t),n(e,te,t),n(e,C,t),le=!0},p:Te,i(e){le||(h(w.$$.fragment,e),h(y.$$.fragment,e),h(g.$$.fragment,e),h(W.$$.fragment,e),h($.$$.fragment,e),h(G.$$.fragment,e),h(j.$$.fragment,e),h(S.$$.fragment,e),le=!0)},o(e){c(w.$$.fragment,e),c(y.$$.fragment,e),c(g.$$.fragment,e),c(W.$$.fragment,e),c($.$$.fragment,e),c(G.$$.fragment,e),c(j.$$.fragment,e),c(S.$$.fragment,e),le=!1},d(e){e&&(l(X),l(V),l(x),l(E),l(M),l(H),l(T),l(L),l(Q),l(J),l(R),l(N),l(U),l(k),l(D),l(v),l(Y),l(O),l(f),l(P),l(Z),l(z),l(F),l(I),l(q),l(A),l(_),l(K),l(B),l(ee),l(te),l(C)),l(m),b(w,e),b(y,e),b(g,e),b(W,e),b($,e),b(G,e),b(j,e),b(S,e)}}}const Ze='{"title":"OpenVINO","local":"openvino","sections":[{"title":"Stable Diffusion","local":"stable-diffusion","sections":[],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2}],"depth":1}';function Ge(ae){return ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Se extends Je{constructor(m){super(),ge(this,m,Ge,$e,Me,{})}}export{Se as component};
