import{s as ye,o as Je,n as Ue}from"../chunks/scheduler.182ea377.js";import{S as ve,i as je,g as p,s as i,r as u,A as _e,h as o,f as l,c as s,j as xe,u as r,x as f,k as me,y as We,a as n,v as d,d as b,t as c,w as h}from"../chunks/index.abf12888.js";import{T as Ge}from"../chunks/Tip.230e2334.js";import{C as N}from"../chunks/CodeBlock.57fe6e13.js";import{H as fe}from"../chunks/Heading.16916d63.js";function Ze(I){let a,T="Generating multiple prompts in a batch seems to take too much memory. While we look into it, you may need to iterate instead of batching.";return{c(){a=p("p"),a.textContent=T},l(m){a=o(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-15fyw3p"&&(a.textContent=T)},m(m,H){n(m,a,H)},p:Ue,d(m){m&&l(a)}}}function Se(I){let a,T,m,H,$,V,g,ue='🤗 <a href="https://github.com/huggingface/optimum" rel="nofollow">Optimum</a> provides a Stable Diffusion pipeline compatible with ONNX Runtime. You’ll need to install 🤗 Optimum with the following command for ONNX Runtime support:',F,x,P,y,re="This guide will show you how to use the Stable Diffusion and Stable Diffusion XL (SDXL) pipelines with ONNX Runtime.",E,J,Q,U,de='To load and run inference, use the <a href="https://huggingface.co/docs/optimum/main/en/onnxruntime/package_reference/modeling_ort#optimum.onnxruntime.ORTStableDiffusionPipeline" rel="nofollow">ORTStableDiffusionPipeline</a>. If you want to load a PyTorch model and convert it to the ONNX format on-the-fly, set <code>export=True</code>:',Y,v,D,w,O,j,be=`To export the pipeline in the ONNX format offline and use it later for inference,
use the <a href="https://huggingface.co/docs/optimum/main/en/exporters/onnx/usage_guides/export_a_model#exporting-a-model-to-onnx-using-the-cli" rel="nofollow"><code>optimum-cli export</code></a> command:`,z,_,q,W,ce="Then to perform inference (you don’t have to specify <code>export=True</code> again):",A,G,K,M,he='<img src="https://huggingface.co/datasets/optimum/documentation-images/resolve/main/onnxruntime/stable_diffusion_v1_5_ort_sail_boat.png"/>',ee,Z,we='You can find more examples in 🤗 Optimum <a href="https://huggingface.co/docs/optimum/" rel="nofollow">documentation</a>, and Stable Diffusion is supported for text-to-image, image-to-image, and inpainting.',te,S,le,B,Me='To load and run inference with SDXL, use the <a href="https://huggingface.co/docs/optimum/main/en/onnxruntime/package_reference/modeling_ort#optimum.onnxruntime.ORTStableDiffusionXLPipeline" rel="nofollow">ORTStableDiffusionXLPipeline</a>:',ne,C,ie,X,Te='To export the pipeline in the ONNX format and use it later for inference, use the <a href="https://huggingface.co/docs/optimum/main/en/exporters/onnx/usage_guides/export_a_model#exporting-a-model-to-onnx-using-the-cli" rel="nofollow"><code>optimum-cli export</code></a> command:',se,R,ae,L,$e="SDXL in the ONNX format is supported for text-to-image and image-to-image.",pe,k,oe;return $=new fe({props:{title:"ONNX Runtime",local:"onnx-runtime",headingTag:"h1"}}),x=new N({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1xJTIwb3B0aW11bSU1QiUyMm9ubnhydW50aW1lJTIyJTVE",highlighted:'pip install -q optimum[<span class="hljs-string">&quot;onnxruntime&quot;</span>]',wrap:!1}}),J=new fe({props:{title:"Stable Diffusion",local:"stable-diffusion",headingTag:"h2"}}),v=new N({props:{code:"ZnJvbSUyMG9wdGltdW0ub25ueHJ1bnRpbWUlMjBpbXBvcnQlMjBPUlRTdGFibGVEaWZmdXNpb25QaXBlbGluZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFwaXBlbGluZSUyMCUzRCUyME9SVFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMGV4cG9ydCUzRFRydWUpJTBBcHJvbXB0JTIwJTNEJTIwJTIyc2FpbGluZyUyMHNoaXAlMjBpbiUyMHN0b3JtJTIwYnklMjBMZW9uYXJkbyUyMGRhJTIwVmluY2klMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCkuaW1hZ2VzJTVCMCU1RCUwQXBpcGVsaW5lLnNhdmVfcHJldHJhaW5lZCglMjIuJTJGb25ueC1zdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIp",highlighted:`<span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTStableDiffusionPipeline

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipeline = ORTStableDiffusionPipeline.from_pretrained(model_id, export=<span class="hljs-literal">True</span>)
prompt = <span class="hljs-string">&quot;sailing ship in storm by Leonardo da Vinci&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
pipeline.save_pretrained(<span class="hljs-string">&quot;./onnx-stable-diffusion-v1-5&quot;</span>)`,wrap:!1}}),w=new Ge({props:{warning:!0,$$slots:{default:[Ze]},$$scope:{ctx:I}}}),_=new N({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBvbm54JTIwLS1tb2RlbCUyMHJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIwc2RfdjE1X29ubnglMkY=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> onnx --model runwayml/stable-diffusion-v1-5 sd_v15_onnx/',wrap:!1}}),G=new N({props:{code:"ZnJvbSUyMG9wdGltdW0ub25ueHJ1bnRpbWUlMjBpbXBvcnQlMjBPUlRTdGFibGVEaWZmdXNpb25QaXBlbGluZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyc2RfdjE1X29ubnglMjIlMEFwaXBlbGluZSUyMCUzRCUyME9SVFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFwcm9tcHQlMjAlM0QlMjAlMjJzYWlsaW5nJTIwc2hpcCUyMGluJTIwc3Rvcm0lMjBieSUyMExlb25hcmRvJTIwZGElMjBWaW5jaSUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTStableDiffusionPipeline

model_id = <span class="hljs-string">&quot;sd_v15_onnx&quot;</span>
pipeline = ORTStableDiffusionPipeline.from_pretrained(model_id)
prompt = <span class="hljs-string">&quot;sailing ship in storm by Leonardo da Vinci&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]`,wrap:!1}}),S=new fe({props:{title:"Stable Diffusion XL",local:"stable-diffusion-xl",headingTag:"h2"}}),C=new N({props:{code:"ZnJvbSUyMG9wdGltdW0ub25ueHJ1bnRpbWUlMjBpbXBvcnQlMjBPUlRTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMEFwaXBlbGluZSUyMCUzRCUyME9SVFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQXByb21wdCUyMCUzRCUyMCUyMnNhaWxpbmclMjBzaGlwJTIwaW4lMjBzdG9ybSUyMGJ5JTIwTGVvbmFyZG8lMjBkYSUyMFZpbmNpJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTStableDiffusionXLPipeline

model_id = <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>
pipeline = ORTStableDiffusionXLPipeline.from_pretrained(model_id)
prompt = <span class="hljs-string">&quot;sailing ship in storm by Leonardo da Vinci&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]`,wrap:!1}}),R=new N({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBvbm54JTIwLS1tb2RlbCUyMHN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMC0tdGFzayUyMHN0YWJsZS1kaWZmdXNpb24teGwlMjBzZF94bF9vbm54JTJG",highlighted:'optimum-cli <span class="hljs-built_in">export</span> onnx --model stabilityai/stable-diffusion-xl-base-1.0 --task stable-diffusion-xl sd_xl_onnx/',wrap:!1}}),{c(){a=p("meta"),T=i(),m=p("p"),H=i(),u($.$$.fragment),V=i(),g=p("p"),g.innerHTML=ue,F=i(),u(x.$$.fragment),P=i(),y=p("p"),y.textContent=re,E=i(),u(J.$$.fragment),Q=i(),U=p("p"),U.innerHTML=de,Y=i(),u(v.$$.fragment),D=i(),u(w.$$.fragment),O=i(),j=p("p"),j.innerHTML=be,z=i(),u(_.$$.fragment),q=i(),W=p("p"),W.innerHTML=ce,A=i(),u(G.$$.fragment),K=i(),M=p("div"),M.innerHTML=he,ee=i(),Z=p("p"),Z.innerHTML=we,te=i(),u(S.$$.fragment),le=i(),B=p("p"),B.innerHTML=Me,ne=i(),u(C.$$.fragment),ie=i(),X=p("p"),X.innerHTML=Te,se=i(),u(R.$$.fragment),ae=i(),L=p("p"),L.textContent=$e,pe=i(),k=p("p"),this.h()},l(e){const t=_e("svelte-u9bgzb",document.head);a=o(t,"META",{name:!0,content:!0}),t.forEach(l),T=s(e),m=o(e,"P",{}),xe(m).forEach(l),H=s(e),r($.$$.fragment,e),V=s(e),g=o(e,"P",{"data-svelte-h":!0}),f(g)!=="svelte-y6glu5"&&(g.innerHTML=ue),F=s(e),r(x.$$.fragment,e),P=s(e),y=o(e,"P",{"data-svelte-h":!0}),f(y)!=="svelte-a0u2"&&(y.textContent=re),E=s(e),r(J.$$.fragment,e),Q=s(e),U=o(e,"P",{"data-svelte-h":!0}),f(U)!=="svelte-nycch4"&&(U.innerHTML=de),Y=s(e),r(v.$$.fragment,e),D=s(e),r(w.$$.fragment,e),O=s(e),j=o(e,"P",{"data-svelte-h":!0}),f(j)!=="svelte-1jrf34f"&&(j.innerHTML=be),z=s(e),r(_.$$.fragment,e),q=s(e),W=o(e,"P",{"data-svelte-h":!0}),f(W)!=="svelte-uler64"&&(W.innerHTML=ce),A=s(e),r(G.$$.fragment,e),K=s(e),M=o(e,"DIV",{class:!0,"data-svelte-h":!0}),f(M)!=="svelte-1pusq1s"&&(M.innerHTML=he),ee=s(e),Z=o(e,"P",{"data-svelte-h":!0}),f(Z)!=="svelte-prwd9a"&&(Z.innerHTML=we),te=s(e),r(S.$$.fragment,e),le=s(e),B=o(e,"P",{"data-svelte-h":!0}),f(B)!=="svelte-ua8g2l"&&(B.innerHTML=Me),ne=s(e),r(C.$$.fragment,e),ie=s(e),X=o(e,"P",{"data-svelte-h":!0}),f(X)!=="svelte-jm4k2m"&&(X.innerHTML=Te),se=s(e),r(R.$$.fragment,e),ae=s(e),L=o(e,"P",{"data-svelte-h":!0}),f(L)!=="svelte-5zcwcl"&&(L.textContent=$e),pe=s(e),k=o(e,"P",{}),xe(k).forEach(l),this.h()},h(){me(a,"name","hf:doc:metadata"),me(a,"content",Be),me(M,"class","flex justify-center")},m(e,t){We(document.head,a),n(e,T,t),n(e,m,t),n(e,H,t),d($,e,t),n(e,V,t),n(e,g,t),n(e,F,t),d(x,e,t),n(e,P,t),n(e,y,t),n(e,E,t),d(J,e,t),n(e,Q,t),n(e,U,t),n(e,Y,t),d(v,e,t),n(e,D,t),d(w,e,t),n(e,O,t),n(e,j,t),n(e,z,t),d(_,e,t),n(e,q,t),n(e,W,t),n(e,A,t),d(G,e,t),n(e,K,t),n(e,M,t),n(e,ee,t),n(e,Z,t),n(e,te,t),d(S,e,t),n(e,le,t),n(e,B,t),n(e,ne,t),d(C,e,t),n(e,ie,t),n(e,X,t),n(e,se,t),d(R,e,t),n(e,ae,t),n(e,L,t),n(e,pe,t),n(e,k,t),oe=!0},p(e,[t]){const ge={};t&2&&(ge.$$scope={dirty:t,ctx:e}),w.$set(ge)},i(e){oe||(b($.$$.fragment,e),b(x.$$.fragment,e),b(J.$$.fragment,e),b(v.$$.fragment,e),b(w.$$.fragment,e),b(_.$$.fragment,e),b(G.$$.fragment,e),b(S.$$.fragment,e),b(C.$$.fragment,e),b(R.$$.fragment,e),oe=!0)},o(e){c($.$$.fragment,e),c(x.$$.fragment,e),c(J.$$.fragment,e),c(v.$$.fragment,e),c(w.$$.fragment,e),c(_.$$.fragment,e),c(G.$$.fragment,e),c(S.$$.fragment,e),c(C.$$.fragment,e),c(R.$$.fragment,e),oe=!1},d(e){e&&(l(T),l(m),l(H),l(V),l(g),l(F),l(P),l(y),l(E),l(Q),l(U),l(Y),l(D),l(O),l(j),l(z),l(q),l(W),l(A),l(K),l(M),l(ee),l(Z),l(te),l(le),l(B),l(ne),l(ie),l(X),l(se),l(ae),l(L),l(pe),l(k)),l(a),h($,e),h(x,e),h(J,e),h(v,e),h(w,e),h(_,e),h(G,e),h(S,e),h(C,e),h(R,e)}}}const Be='{"title":"ONNX Runtime","local":"onnx-runtime","sections":[{"title":"Stable Diffusion","local":"stable-diffusion","sections":[],"depth":2},{"title":"Stable Diffusion XL","local":"stable-diffusion-xl","sections":[],"depth":2}],"depth":1}';function Ce(I){return Je(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ke extends ve{constructor(a){super(),je(this,a,Ce,Se,ye,{})}}export{ke as component};
