import{s as Je,n as ye,o as ge}from"../chunks/scheduler.53228c21.js";import{S as Ue,i as $e,e as a,s as i,c as f,h as ve,a as p,d as l,b as s,f as Te,g as u,j as o,k as ae,l as Ge,m as n,n as r,t as d,o as h,p as c}from"../chunks/index.100fac89.js";import{C as We}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{C as se}from"../chunks/CodeBlock.d30a6509.js";import{H as pe,E as Ze}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function Ie(oe){let m,X,C,L,w,H,M,E,T,me='🤗 <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).',k,J,fe='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:',D,y,R,g,ue="This guide will show you how to use the Stable Diffusion and Stable Diffusion XL (SDXL) pipelines with OpenVINO.",z,U,F,$,re="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>:",N,v,Y,G,de="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.",Q,W,O,b,he='<img src="https://huggingface.co/datasets/optimum/documentation-images/resolve/main/intel/openvino/stable_diffusion_v1_5_sail_boat_rembrandt.png"/>',P,Z,ce='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.',q,I,A,j,be="To load and run inference with SDXL, use the <code>OVStableDiffusionXLPipeline</code>:",K,_,ee,V,we='To further speed-up inference, <a href="#stable-diffusion">statically reshape</a> the model as shown in the Stable Diffusion section.',te,x,Me='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.',le,B,ne,S,ie;return w=new We({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),M=new pe({props:{title:"OpenVINO",local:"openvino",headingTag:"h1"}}),y=new se({props:{code:"cGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZS1zdHJhdGVneSUyMGVhZ2VyJTIwb3B0aW11bSU1QiUyMm9wZW52aW5vJTIyJTVE",highlighted:'pip install --upgrade-strategy eager optimum[<span class="hljs-string">&quot;openvino&quot;</span>]',wrap:!1}}),U=new pe({props:{title:"Stable Diffusion",local:"stable-diffusion",headingTag:"h2"}}),v=new se({props:{code:"ZnJvbSUyMG9wdGltdW0uaW50ZWwlMjBpbXBvcnQlMjBPVlN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJzdGFibGUtZGlmZnVzaW9uLXYxLTUlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFwaXBlbGluZSUyMCUzRCUyME9WU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwZXhwb3J0JTNEVHJ1ZSklMEFwcm9tcHQlMjAlM0QlMjAlMjJzYWlsaW5nJTIwc2hpcCUyMGluJTIwc3Rvcm0lMjBieSUyMFJlbWJyYW5kdCUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBBJTBBJTIzJTIwRG9uJ3QlMjBmb3JnZXQlMjB0byUyMHNhdmUlMjB0aGUlMjBleHBvcnRlZCUyMG1vZGVsJTBBcGlwZWxpbmUuc2F2ZV9wcmV0cmFpbmVkKCUyMm9wZW52aW5vLXNkLXYxLTUlMjIp",highlighted:`<span class="hljs-keyword">from</span> optimum.intel <span class="hljs-keyword">import</span> OVStableDiffusionPipeline

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