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 Ge,h as o,f as l,c as s,j as xe,u as r,x as f,k as me,y as _e,a as n,v as d,d as b,t as c,w as h}from"../chunks/index.abf12888.js";import{T as We}from"../chunks/Tip.230e2334.js";import{C as H}from"../chunks/CodeBlock.57fe6e13.js";import{H as fe}from"../chunks/Heading.16916d63.js";function Ze(I){let a,$="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=$},l(m){a=o(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-15fyw3p"&&(a.textContent=$)},m(m,N){n(m,a,N)},p:Ue,d(m){m&&l(a)}}}function Se(I){let a,$,m,N,g,V,T,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/v1.14.0/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,G,q,_,ce="Then to perform inference (you don’t have to specify <code>export=True</code> again):",A,W,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/v1.14.0/en/onnxruntime/package_reference/modeling_ort#optimum.onnxruntime.ORTStableDiffusionXLPipeline" rel="nofollow">ORTStableDiffusionXLPipeline</a>:',ne,C,ie,R,$e='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,X,ae,L,ge="SDXL in the ONNX format is supported for text-to-image and image-to-image.",pe,k,oe;return g=new fe({props:{title:"ONNX Runtime",local:"onnx-runtime",headingTag:"h1"}}),x=new H({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0lNUIlMjJvbm54cnVudGltZSUyMiU1RA==",highlighted:'pip install 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 H({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 We({props:{warning:!0,$$slots:{default:[Ze]},$$scope:{ctx:I}}}),G=new H({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}}),W=new H({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 H({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}}),X=new H({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"),$=i(),m=p("p"),N=i(),u(g.$$.fragment),V=i(),T=p("p"),T.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(G.$$.fragment),q=i(),_=p("p"),_.innerHTML=ce,A=i(),u(W.$$.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(),R=p("p"),R.innerHTML=$e,se=i(),u(X.$$.fragment),ae=i(),L=p("p"),L.textContent=ge,pe=i(),k=p("p"),this.h()},l(e){const t=Ge("svelte-u9bgzb",document.head);a=o(t,"META",{name:!0,content:!0}),t.forEach(l),$=s(e),m=o(e,"P",{}),xe(m).forEach(l),N=s(e),r(g.$$.fragment,e),V=s(e),T=o(e,"P",{"data-svelte-h":!0}),f(T)!=="svelte-y6glu5"&&(T.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-qj8y1p"&&(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(G.$$.fragment,e),q=s(e),_=o(e,"P",{"data-svelte-h":!0}),f(_)!=="svelte-uler64"&&(_.innerHTML=ce),A=s(e),r(W.$$.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-lndrb8"&&(B.innerHTML=Me),ne=s(e),r(C.$$.fragment,e),ie=s(e),R=o(e,"P",{"data-svelte-h":!0}),f(R)!=="svelte-jm4k2m"&&(R.innerHTML=$e),se=s(e),r(X.$$.fragment,e),ae=s(e),L=o(e,"P",{"data-svelte-h":!0}),f(L)!=="svelte-5zcwcl"&&(L.textContent=ge),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){_e(document.head,a),n(e,$,t),n(e,m,t),n(e,N,t),d(g,e,t),n(e,V,t),n(e,T,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(G,e,t),n(e,q,t),n(e,_,t),n(e,A,t),d(W,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,R,t),n(e,se,t),d(X,e,t),n(e,ae,t),n(e,L,t),n(e,pe,t),n(e,k,t),oe=!0},p(e,[t]){const Te={};t&2&&(Te.$$scope={dirty:t,ctx:e}),w.$set(Te)},i(e){oe||(b(g.$$.fragment,e),b(x.$$.fragment,e),b(J.$$.fragment,e),b(v.$$.fragment,e),b(w.$$.fragment,e),b(G.$$.fragment,e),b(W.$$.fragment,e),b(S.$$.fragment,e),b(C.$$.fragment,e),b(X.$$.fragment,e),oe=!0)},o(e){c(g.$$.fragment,e),c(x.$$.fragment,e),c(J.$$.fragment,e),c(v.$$.fragment,e),c(w.$$.fragment,e),c(G.$$.fragment,e),c(W.$$.fragment,e),c(S.$$.fragment,e),c(C.$$.fragment,e),c(X.$$.fragment,e),oe=!1},d(e){e&&(l($),l(m),l(N),l(V),l(T),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(_),l(A),l(K),l(M),l(ee),l(Z),l(te),l(le),l(B),l(ne),l(ie),l(R),l(se),l(ae),l(L),l(pe),l(k)),l(a),h(g,e),h(x,e),h(J,e),h(v,e),h(w,e),h(G,e),h(W,e),h(S,e),h(C,e),h(X,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};
