Buckets:

rtrm's picture
download
raw
9.13 kB
import{s as se,f as ie,o as oe,n as re}from"../chunks/scheduler.8c3d61f6.js";import{S as me,i as pe,g as r,s,r as I,A as ue,h as m,f as n,c as i,j as le,u as _,x as j,k as W,y as ce,a,v as C,d as Z,t as x,w as G}from"../chunks/index.da70eac4.js";import{T as fe}from"../chunks/Tip.1d9b8c37.js";import{C as P}from"../chunks/CodeBlock.00a903b3.js";import{H as he,E as Me}from"../chunks/EditOnGithub.1e64e623.js";function de(X){let l,c='We provide pre-built <a href="https://aws.amazon.com/marketplace/pp/prodview-gr3e6yiscria2" rel="nofollow">Hugging Face Neuron Deep Learning AMI</a> (DLAMI) and Optimum Neuron containers for Amazon SageMaker. It’s recommended to correctly set up your environment.';return{c(){l=r("p"),l.innerHTML=c},l(o){l=m(o,"P",{"data-svelte-h":!0}),j(l)!=="svelte-bsqksy"&&(l.innerHTML=c)},m(o,$){a(o,l,$)},p:re,d(o){o&&n(l)}}}function we(X){let l,c,o,$,f,v,h,E='Diffusers functionalities are available on <a href="https://aws.amazon.com/ec2/instance-types/inf2/" rel="nofollow">AWS Inf2 instances</a>, which are EC2 instances powered by <a href="https://aws.amazon.com/machine-learning/inferentia/" rel="nofollow">Neuron machine learning accelerators</a>. These instances aim to provide better compute performance (higher throughput, lower latency) with good cost-efficiency, making them good candidates for AWS users to deploy diffusion models to production.',H,M,O='<a href="https://huggingface.co/docs/optimum-neuron/en/index" rel="nofollow">Optimum Neuron</a> is the interface between Hugging Face libraries and AWS Accelerators, including AWS <a href="https://aws.amazon.com/machine-learning/trainium/" rel="nofollow">Trainium</a> and AWS <a href="https://aws.amazon.com/machine-learning/inferentia/" rel="nofollow">Inferentia</a>. It supports many of the features in Diffusers with similar APIs, so it is easier to learn if you’re already familiar with Diffusers. Once you have created an AWS Inf2 instance, install Optimum Neuron.',S,d,L,u,A,w,q='The example below demonstrates how to generate images with the Stable Diffusion XL model on an inf2.8xlarge instance (you can switch to cheaper inf2.xlarge instances once the model is compiled). To generate some images, use the <code>NeuronStableDiffusionXLPipeline</code> class, which is similar to the <a href="/docs/diffusers/pr_10101/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline">StableDiffusionXLPipeline</a> class in Diffusers.',N,y,K="Unlike Diffusers, you need to compile models in the pipeline to the Neuron format, <code>.neuron</code>. Launch the following command to export the model to the <code>.neuron</code> format.",Y,g,k,b,ee="Now generate some images with the pre-compiled SDXL model.",V,T,R,p,te,z,J,ne='Feel free to check out more guides and examples on different use cases from the Optimum Neuron <a href="https://huggingface.co/docs/optimum-neuron/en/inference_tutorials/stable_diffusion#generate-images-with-stable-diffusion-models-on-aws-inferentia" rel="nofollow">documentation</a>!',Q,U,D,B,F;return f=new he({props:{title:"AWS Neuron",local:"aws-neuron",headingTag:"h1"}}),d=new P({props:{code:"cHl0aG9uJTIwLW0lMjBwaXAlMjBpbnN0YWxsJTIwLS11cGdyYWRlLXN0cmF0ZWd5JTIwZWFnZXIlMjBvcHRpbXVtJTVCbmV1cm9ueCU1RA==",highlighted:"python -m pip install --upgrade-strategy eager optimum[neuronx]",wrap:!1}}),u=new fe({props:{$$slots:{default:[de]},$$scope:{ctx:X}}}),g=new P({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIwJTVDJTBBJTIwJTIwLS1iYXRjaF9zaXplJTIwMSUyMCU1QyUwQSUyMCUyMC0taGVpZ2h0JTIwMTAyNCUyMCU2MCUyMyUyMGhlaWdodCUyMGluJTIwcGl4ZWxzJTIwb2YlMjBnZW5lcmF0ZWQlMjBpbWFnZSUyQyUyMGVnLiUyMDc2OCUyQyUyMDEwMjQlNjAlMjAlNUMlMEElMjAlMjAtLXdpZHRoJTIwMTAyNCUyMCU2MCUyMyUyMHdpZHRoJTIwaW4lMjBwaXhlbHMlMjBvZiUyMGdlbmVyYXRlZCUyMGltYWdlJTJDJTIwZWcuJTIwNzY4JTJDJTIwMTAyNCU2MCUyMCU1QyUwQSUyMCUyMC0tbnVtX2ltYWdlc19wZXJfcHJvbXB0JTIwMSUyMCU2MCUyMyUyMG51bWJlciUyMG9mJTIwaW1hZ2VzJTIwdG8lMjBnZW5lcmF0ZSUyMHBlciUyMHByb21wdCUyQyUyMGRlZmF1bHRzJTIwdG8lMjAxJTYwJTIwJTVDJTBBJTIwJTIwLS1hdXRvX2Nhc3QlMjBtYXRtdWwlMjAlNjAlMjMlMjBjYXN0JTIwb25seSUyMG1hdHJpeCUyMG11bHRpcGxpY2F0aW9uJTIwb3BlcmF0aW9ucyU2MCUyMCU1QyUwQSUyMCUyMC0tYXV0b19jYXN0X3R5cGUlMjBiZjE2JTIwJTYwJTIzJTIwY2FzdCUyMG9wZXJhdGlvbnMlMjBmcm9tJTIwRlAzMiUyMHRvJTIwQkYxNiU2MCUyMCU1QyUwQSUyMCUyMHNkX25ldXJvbl94bCUyRg==",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --model stabilityai/stable-diffusion-xl-base-1.0 \\\n --batch_size 1 \\\n --height 1024 `<span class="hljs-comment"># height in pixels of generated image, eg. 768, 1024` \\</span>\n --width 1024 `<span class="hljs-comment"># width in pixels of generated image, eg. 768, 1024` \\</span>\n --num_images_per_prompt 1 `<span class="hljs-comment"># number of images to generate per prompt, defaults to 1` \\</span>\n --auto_cast matmul `<span class="hljs-comment"># cast only matrix multiplication operations` \\</span>\n --auto_cast_type bf16 `<span class="hljs-comment"># cast operations from FP32 to BF16` \\</span>\n sd_neuron_xl/',wrap:!1}}),T=new P({props:{code:"ZnJvbSUyMG9wdGltdW0ubmV1cm9uJTIwaW1wb3J0JTIwTmV1cm9uU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQSUwQXN0YWJsZV9kaWZmdXNpb25feGwlMjAlM0QlMjBOZXVyb25TdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJzZF9uZXVyb25feGwlMkYlMjIpJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMHBpZyUyMHdpdGglMjB3aW5ncyUyMGZseWluZyUyMGluJTIwZmxvYXRpbmclMjBVUyUyMGRvbGxhciUyMGJhbmtub3RlcyUyMGluJTIwdGhlJTIwYWlyJTJDJTIwc2t5c2NyYXBlcnMlMjBiZWhpbmQlMkMlMjB3YXJtJTIwY29sb3IlMjBwYWxldHRlJTJDJTIwbXV0ZWQlMjBjb2xvcnMlMkMlMjBkZXRhaWxlZCUyQyUyMDhrJTIyJTBBaW1hZ2UlMjAlM0QlMjBzdGFibGVfZGlmZnVzaW9uX3hsKHByb21wdCkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronStableDiffusionXLPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span>stable_diffusion_xl = NeuronStableDiffusionXLPipeline.from_pretrained(<span class="hljs-string">&quot;sd_neuron_xl/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a pig with wings flying in floating US dollar banknotes in the air, skyscrapers behind, warm color palette, muted colors, detailed, 8k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = stable_diffusion_xl(prompt).images[<span class="hljs-number">0</span>]`,wrap:!1}}),U=new Me({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/optimization/neuron.md"}}),{c(){l=r("meta"),c=s(),o=r("p"),$=s(),I(f.$$.fragment),v=s(),h=r("p"),h.innerHTML=E,H=s(),M=r("p"),M.innerHTML=O,S=s(),I(d.$$.fragment),L=s(),I(u.$$.fragment),A=s(),w=r("p"),w.innerHTML=q,N=s(),y=r("p"),y.innerHTML=K,Y=s(),I(g.$$.fragment),k=s(),b=r("p"),b.textContent=ee,V=s(),I(T.$$.fragment),R=s(),p=r("img"),z=s(),J=r("p"),J.innerHTML=ne,Q=s(),I(U.$$.fragment),D=s(),B=r("p"),this.h()},l(e){const t=ue("svelte-u9bgzb",document.head);l=m(t,"META",{name:!0,content:!0}),t.forEach(n),c=i(e),o=m(e,"P",{}),le(o).forEach(n),$=i(e),_(f.$$.fragment,e),v=i(e),h=m(e,"P",{"data-svelte-h":!0}),j(h)!=="svelte-eya34r"&&(h.innerHTML=E),H=i(e),M=m(e,"P",{"data-svelte-h":!0}),j(M)!=="svelte-ehk4ph"&&(M.innerHTML=O),S=i(e),_(d.$$.fragment,e),L=i(e),_(u.$$.fragment,e),A=i(e),w=m(e,"P",{"data-svelte-h":!0}),j(w)!=="svelte-csfcxn"&&(w.innerHTML=q),N=i(e),y=m(e,"P",{"data-svelte-h":!0}),j(y)!=="svelte-17pa8nm"&&(y.innerHTML=K),Y=i(e),_(g.$$.fragment,e),k=i(e),b=m(e,"P",{"data-svelte-h":!0}),j(b)!=="svelte-1vi0ulx"&&(b.textContent=ee),V=i(e),_(T.$$.fragment,e),R=i(e),p=m(e,"IMG",{src:!0,width:!0,height:!0,alt:!0}),z=i(e),J=m(e,"P",{"data-svelte-h":!0}),j(J)!=="svelte-1hx5why"&&(J.innerHTML=ne),Q=i(e),_(U.$$.fragment,e),D=i(e),B=m(e,"P",{}),le(B).forEach(n),this.h()},h(){W(l,"name","hf:doc:metadata"),W(l,"content",ye),ie(p.src,te="https://huggingface.co/datasets/Jingya/document_images/resolve/main/optimum/neuron/sdxl_pig.png")||W(p,"src",te),W(p,"width","256"),W(p,"height","256"),W(p,"alt","peggy generated by sdxl on inf2")},m(e,t){ce(document.head,l),a(e,c,t),a(e,o,t),a(e,$,t),C(f,e,t),a(e,v,t),a(e,h,t),a(e,H,t),a(e,M,t),a(e,S,t),C(d,e,t),a(e,L,t),C(u,e,t),a(e,A,t),a(e,w,t),a(e,N,t),a(e,y,t),a(e,Y,t),C(g,e,t),a(e,k,t),a(e,b,t),a(e,V,t),C(T,e,t),a(e,R,t),a(e,p,t),a(e,z,t),a(e,J,t),a(e,Q,t),C(U,e,t),a(e,D,t),a(e,B,t),F=!0},p(e,[t]){const ae={};t&2&&(ae.$$scope={dirty:t,ctx:e}),u.$set(ae)},i(e){F||(Z(f.$$.fragment,e),Z(d.$$.fragment,e),Z(u.$$.fragment,e),Z(g.$$.fragment,e),Z(T.$$.fragment,e),Z(U.$$.fragment,e),F=!0)},o(e){x(f.$$.fragment,e),x(d.$$.fragment,e),x(u.$$.fragment,e),x(g.$$.fragment,e),x(T.$$.fragment,e),x(U.$$.fragment,e),F=!1},d(e){e&&(n(c),n(o),n($),n(v),n(h),n(H),n(M),n(S),n(L),n(A),n(w),n(N),n(y),n(Y),n(k),n(b),n(V),n(R),n(p),n(z),n(J),n(Q),n(D),n(B)),n(l),G(f,e),G(d,e),G(u,e),G(g,e),G(T,e),G(U,e)}}}const ye='{"title":"AWS Neuron","local":"aws-neuron","sections":[],"depth":1}';function ge(X){return oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends me{constructor(l){super(),pe(this,l,ge,we,se,{})}}export{$e as component};

Xet Storage Details

Size:
9.13 kB
·
Xet hash:
4788cc0dc67ef8f2832e29667d89862a5bb9269639fd9fb72df5aee995ef67e7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.