import{s as we,n as Me,o as be}from"../chunks/scheduler.182ea377.js";import{S as Te,i as ye,g as a,s as i,r as G,A as Je,h as p,f as l,c as s,j as ce,u as I,x as o,k as le,y as ge,a as n,v as j,d as $,t as _,w as B}from"../chunks/index.1ea56653.js";import{H as ne,g as Ue}from"../chunks/Heading.71ac6e9f.js";import{C as te}from"../chunks/CodeBlock.82c2494b.js";function We(ie){let m,C,S,X,r,x,u,se='🤗 <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).',E,d,ae='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:',H,h,L,c,pe="This guide will show you how to use the Stable Diffusion and Stable Diffusion XL (SDXL) pipelines with OpenVINO.",Q,w,R,M,oe="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,b,D,T,me="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.",k,y,Y,f,fe='<img src="https://huggingface.co/datasets/optimum/documentation-images/resolve/main/intel/openvino/stable_diffusion_v1_5_sail_boat_rembrandt.png"/>',P,J,re='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.',O,g,z,U,ue="To load and run inference with SDXL, use the <code>OVStableDiffusionXLPipeline</code>:",F,W,q,v,de='To further speed-up inference, <a href="#stable-diffusion">statically reshape</a> the model as shown in the Stable Diffusion section.',A,Z,he='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.',K,V,ee;return r=new ne({props:{title:"OpenVINO",local:"openvino",headingTag:"h1"}}),h=new te({props:{code:"cGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZS1zdHJhdGVneSUyMGVhZ2VyJTIwb3B0aW11bSU1QiUyMm9wZW52aW5vJTIyJTVE",highlighted:'pip install --upgrade-strategy eager optimum[<span class="hljs-string">&quot;openvino&quot;</span>]',wrap:!1}}),w=new ne({props:{title:"Stable Diffusion",local:"stable-diffusion",headingTag:"h2"}}),b=new te({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}}),y=new te({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 ne({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),W=new te({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}}),{c(){m=a("meta"),C=i(),S=a("p"),X=i(),G(r.$$.fragment),x=i(),u=a("p"),u.innerHTML=se,E=i(),d=a("p"),d.innerHTML=ae,H=i(),G(h.$$.fragment),L=i(),c=a("p"),c.textContent=pe,Q=i(),G(w.$$.fragment),R=i(),M=a("p"),M.innerHTML=oe,N=i(),G(b.$$.fragment),D=i(),T=a("p"),T.textContent=me,k=i(),G(y.$$.fragment),Y=i(),f=a("div"),f.innerHTML=fe,P=i(),J=a("p"),J.innerHTML=re,O=i(),G(g.$$.fragment),z=i(),U=a("p"),U.innerHTML=ue,F=i(),G(W.$$.fragment),q=i(),v=a("p"),v.innerHTML=de,A=i(),Z=a("p"),Z.innerHTML=he,K=i(),V=a("p"),this.h()},l(e){const t=Je("svelte-u9bgzb",document.head);m=p(t,"META",{name:!0,content:!0}),t.forEach(l),C=s(e),S=p(e,"P",{}),ce(S).forEach(l),X=s(e),I(r.$$.fragment,e),x=s(e),u=p(e,"P",{"data-svelte-h":!0}),o(u)!=="svelte-8v4mnh"&&(u.innerHTML=se),E=s(e),d=p(e,"P",{"data-svelte-h":!0}),o(d)!=="svelte-1yjuyfl"&&(d.innerHTML=ae),H=s(e),I(h.$$.fragment,e),L=s(e),c=p(e,"P",{"data-svelte-h":!0}),o(c)!=="svelte-rxdhyz"&&(c.textContent=pe),Q=s(e),I(w.$$.fragment,e),R=s(e),M=p(e,"P",{"data-svelte-h":!0}),o(M)!=="svelte-1150q8r"&&(M.innerHTML=oe),N=s(e),I(b.$$.fragment,e),D=s(e),T=p(e,"P",{"data-svelte-h":!0}),o(T)!=="svelte-1pgwlbo"&&(T.textContent=me),k=s(e),I(y.$$.fragment,e),Y=s(e),f=p(e,"DIV",{class:!0,"data-svelte-h":!0}),o(f)!=="svelte-1bbei4i"&&(f.innerHTML=fe),P=s(e),J=p(e,"P",{"data-svelte-h":!0}),o(J)!=="svelte-al50pl"&&(J.innerHTML=re),O=s(e),I(g.$$.fragment,e),z=s(e),U=p(e,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1a3vd4r"&&(U.innerHTML=ue),F=s(e),I(W.$$.fragment,e),q=s(e),v=p(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-1ku614i"&&(v.innerHTML=de),A=s(e),Z=p(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-ar6dc6"&&(Z.innerHTML=he),K=s(e),V=p(e,"P",{}),ce(V).forEach(l),this.h()},h(){le(m,"name","hf:doc:metadata"),le(m,"content",ve),le(f,"class","flex justify-center")},m(e,t){ge(document.head,m),n(e,C,t),n(e,S,t),n(e,X,t),j(r,e,t),n(e,x,t),n(e,u,t),n(e,E,t),n(e,d,t),n(e,H,t),j(h,e,t),n(e,L,t),n(e,c,t),n(e,Q,t),j(w,e,t),n(e,R,t),n(e,M,t),n(e,N,t),j(b,e,t),n(e,D,t),n(e,T,t),n(e,k,t),j(y,e,t),n(e,Y,t),n(e,f,t),n(e,P,t),n(e,J,t),n(e,O,t),j(g,e,t),n(e,z,t),n(e,U,t),n(e,F,t),j(W,e,t),n(e,q,t),n(e,v,t),n(e,A,t),n(e,Z,t),n(e,K,t),n(e,V,t),ee=!0},p:Me,i(e){ee||($(r.$$.fragment,e),$(h.$$.fragment,e),$(w.$$.fragment,e),$(b.$$.fragment,e),$(y.$$.fragment,e),$(g.$$.fragment,e),$(W.$$.fragment,e),ee=!0)},o(e){_(r.$$.fragment,e),_(h.$$.fragment,e),_(w.$$.fragment,e),_(b.$$.fragment,e),_(y.$$.fragment,e),_(g.$$.fragment,e),_(W.$$.fragment,e),ee=!1},d(e){e&&(l(C),l(S),l(X),l(x),l(u),l(E),l(d),l(H),l(L),l(c),l(Q),l(R),l(M),l(N),l(D),l(T),l(k),l(Y),l(f),l(P),l(J),l(O),l(z),l(U),l(F),l(q),l(v),l(A),l(Z),l(K),l(V)),l(m),B(r,e),B(h,e),B(w,e),B(b,e),B(y,e),B(g,e),B(W,e)}}}const ve='{"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 Ze(ie){return be(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=Ue}),[]}class _e extends Te{constructor(m){super(),ye(this,m,Ze,We,we,{})}}export{_e as component};
