import{s as oe,o as re,n as pe}from"../chunks/scheduler.56725da7.js";import{S as me,i as ue,e as r,s,c as u,h as fe,a as p,d as l,b as a,f as ie,g as f,j as C,k as se,l as ce,m as n,n as c,t as h,o as d,p as $}from"../chunks/index.18a26576.js";import{T as he}from"../chunks/Tip.5b941656.js";import{C as de}from"../chunks/CopyLLMTxtMenu.d7849104.js";import{C as ae}from"../chunks/CodeBlock.446b613c.js";import{H as A}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.6e374671.js";function $e(I){let i,b="Inf2 instances contain one or more Neuron devices, and each Neuron device includes 2 NeuronCore-v2. By default, we load the whole pipeline of LCM to both Neuron cores. It means that when the batch size is divisible by 2, you can fully leverage the compute power of both cores.";return{c(){i=r("p"),i.textContent=b},l(o){i=p(o,"P",{"data-svelte-h":!0}),C(i)!=="svelte-3zwean"&&(i.textContent=b)},m(o,S){n(o,i,S)},p:pe,d(o){o&&l(i)}}}function be(I){let i,b,o,S,w,Z,M,R,g,G,y,q='SDXL Turbo is an adversarial time-distilled Stable Diffusion XL (SDXL) model capable of running inference in as little as 1 step (<a href="https://huggingface.co/docs/diffusers/using-diffusers/sdxl_turbo" rel="nofollow">check <code>🤗diffusers</code> for more details</a>).',W,T,O="In <code>optimum-neuron</code>, you can:",k,v,K="<li>Use the class <code>NeuronStableDiffusionXLPipeline</code> to compile and run inference.</li>",B,x,ee='Here we will compile the <a href="https://huggingface.co/stabilityai/sdxl-turbo" rel="nofollow"><code>stabilityai/sdxl-turbo</code></a> model with Optimum CLI.',V,_,N,J,P,X,z,L,te="Now we can generate images from text prompts on Inf2 using the pre-compiled model:",Y,j,F,m,Q,U,le='Are there any other diffusion features that you want us to support in 🤗<code>Optimum-neuron</code>? Please file an issue to <a href="https://github.com/huggingface/optimum-neuron" rel="nofollow"><code>Optimum-neuron</code> Github repo</a> or discuss with us on <a href="https://discuss.huggingface.co/c/optimum/" rel="nofollow">HuggingFace’s community forum</a>, cheers 🤗 !',E,H,D;return w=new de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),M=new A({props:{title:"Stable Diffusion XL Turbo",local:"stable-diffusion-xl-turbo",headingTag:"h1"}}),g=new A({props:{title:"Overview",local:"overview",headingTag:"h2"}}),_=new A({props:{title:"Export to Neuron",local:"export-to-neuron",headingTag:"h2"}}),J=new ae({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwc3RhYmlsaXR5YWklMkZzZHhsLXR1cmJvJTIwLS1iYXRjaF9zaXplJTIwMSUyMC0taGVpZ2h0JTIwNTEyJTIwLS13aWR0aCUyMDUxMiUyMC0tYXV0b19jYXN0JTIwbWF0bXVsJTIwLS1hdXRvX2Nhc3RfdHlwZSUyMGJmMTYlMjBzZHhsX3R1cmJvX25ldXJvbiUyRg==",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --model stabilityai/sdxl-turbo --batch_size 1 --height 512 --width 512 --auto_cast matmul --auto_cast_type bf16 sdxl_turbo_neuron/',wrap:!1}}),X=new A({props:{title:"Text-to-Image",local:"text-to-image",headingTag:"h2"}}),j=new ae({props:{code:"ZnJvbSUyMG9wdGltdW0ubmV1cm9uJTIwaW1wb3J0JTIwTmV1cm9uU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBOZXVyb25TdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJzZHhsX3R1cmJvX25ldXJvbiUyRiUyMiUyQyUyMGRhdGFfcGFyYWxsZWxfbW9kZSUzRCUyMmFsbCUyMiklMEFwcm9tcHQlMjAlM0QlMjAlNUIlMjJTZWxmLXBvcnRyYWl0JTIwb2lsJTIwcGFpbnRpbmclMkMlMjBhJTIwYmVhdXRpZnVsJTIwY3lib3JnJTIwd2l0aCUyMGdvbGRlbiUyMGhhaXIlMkMlMjA4ayUyMiU1RCUyMColMjAyJTBBJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDAuMCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxKS5pbWFnZXM=",highlighted:`<span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronStableDiffusionXLPipeline

pipe = NeuronStableDiffusionXLPipeline.from_pretrained(<span class="hljs-string">&quot;sdxl_turbo_neuron/&quot;</span>, data_parallel_mode=<span class="hljs-string">&quot;all&quot;</span>)
prompt = [<span class="hljs-string">&quot;Self-portrait oil painting, a beautiful cyborg with golden hair, 8k&quot;</span>] * <span class="hljs-number">2</span>

images = pipe(prompt=prompt, guidance_scale=<span class="hljs-number">0.0</span>, num_inference_steps=<span class="hljs-number">1</span>).images`,wrap:!1}}),m=new he({props:{$$slots:{default:[$e]},$$scope:{ctx:I}}}),{c(){i=r("meta"),b=s(),o=r("p"),S=s(),u(w.$$.fragment),Z=s(),u(M.$$.fragment),R=s(),u(g.$$.fragment),G=s(),y=r("p"),y.innerHTML=q,W=s(),T=r("p"),T.innerHTML=O,k=s(),v=r("ul"),v.innerHTML=K,B=s(),x=r("p"),x.innerHTML=ee,V=s(),u(_.$$.fragment),N=s(),u(J.$$.fragment),P=s(),u(X.$$.fragment),z=s(),L=r("p"),L.textContent=te,Y=s(),u(j.$$.fragment),F=s(),u(m.$$.fragment),Q=s(),U=r("p"),U.innerHTML=le,E=s(),H=r("p"),this.h()},l(e){const t=fe("svelte-u9bgzb",document.head);i=p(t,"META",{name:!0,content:!0}),t.forEach(l),b=a(e),o=p(e,"P",{}),ie(o).forEach(l),S=a(e),f(w.$$.fragment,e),Z=a(e),f(M.$$.fragment,e),R=a(e),f(g.$$.fragment,e),G=a(e),y=p(e,"P",{"data-svelte-h":!0}),C(y)!=="svelte-10h80ju"&&(y.innerHTML=q),W=a(e),T=p(e,"P",{"data-svelte-h":!0}),C(T)!=="svelte-1ayizu6"&&(T.innerHTML=O),k=a(e),v=p(e,"UL",{"data-svelte-h":!0}),C(v)!=="svelte-t7g18i"&&(v.innerHTML=K),B=a(e),x=p(e,"P",{"data-svelte-h":!0}),C(x)!=="svelte-ohwj0a"&&(x.innerHTML=ee),V=a(e),f(_.$$.fragment,e),N=a(e),f(J.$$.fragment,e),P=a(e),f(X.$$.fragment,e),z=a(e),L=p(e,"P",{"data-svelte-h":!0}),C(L)!=="svelte-1ebkvay"&&(L.textContent=te),Y=a(e),f(j.$$.fragment,e),F=a(e),f(m.$$.fragment,e),Q=a(e),U=p(e,"P",{"data-svelte-h":!0}),C(U)!=="svelte-1wos5lv"&&(U.innerHTML=le),E=a(e),H=p(e,"P",{}),ie(H).forEach(l),this.h()},h(){se(i,"name","hf:doc:metadata"),se(i,"content",we)},m(e,t){ce(document.head,i),n(e,b,t),n(e,o,t),n(e,S,t),c(w,e,t),n(e,Z,t),c(M,e,t),n(e,R,t),c(g,e,t),n(e,G,t),n(e,y,t),n(e,W,t),n(e,T,t),n(e,k,t),n(e,v,t),n(e,B,t),n(e,x,t),n(e,V,t),c(_,e,t),n(e,N,t),c(J,e,t),n(e,P,t),c(X,e,t),n(e,z,t),n(e,L,t),n(e,Y,t),c(j,e,t),n(e,F,t),c(m,e,t),n(e,Q,t),n(e,U,t),n(e,E,t),n(e,H,t),D=!0},p(e,[t]){const ne={};t&2&&(ne.$$scope={dirty:t,ctx:e}),m.$set(ne)},i(e){D||(h(w.$$.fragment,e),h(M.$$.fragment,e),h(g.$$.fragment,e),h(_.$$.fragment,e),h(J.$$.fragment,e),h(X.$$.fragment,e),h(j.$$.fragment,e),h(m.$$.fragment,e),D=!0)},o(e){d(w.$$.fragment,e),d(M.$$.fragment,e),d(g.$$.fragment,e),d(_.$$.fragment,e),d(J.$$.fragment,e),d(X.$$.fragment,e),d(j.$$.fragment,e),d(m.$$.fragment,e),D=!1},d(e){e&&(l(b),l(o),l(S),l(Z),l(R),l(G),l(y),l(W),l(T),l(k),l(v),l(B),l(x),l(V),l(N),l(P),l(z),l(L),l(Y),l(F),l(Q),l(U),l(E),l(H)),l(i),$(w,e),$(M,e),$(g,e),$(_,e),$(J,e),$(X,e),$(j,e),$(m,e)}}}const we='{"title":"Stable Diffusion XL Turbo","local":"stable-diffusion-xl-turbo","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Export to Neuron","local":"export-to-neuron","sections":[],"depth":2},{"title":"Text-to-Image","local":"text-to-image","sections":[],"depth":2}],"depth":1}';function Me(I){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Je extends me{constructor(i){super(),ue(this,i,Me,be,oe,{})}}export{Je as component};
