import{s as Bn,o as Ln,n as at,a as En}from"../chunks/scheduler.56725da7.js";import{S as Sn,i as Fn,e as i,s,c as u,h as Rn,a as r,d as l,b as a,f as An,g as M,j as p,k as st,l as zn,m as n,n as d,t as c,o as f,p as h,q as Vn,r as Wn}from"../chunks/index.18a26576.js";import{T as lt}from"../chunks/Tip.5b941656.js";import{C as Yn}from"../chunks/CopyLLMTxtMenu.a8c0e768.js";import{C as U}from"../chunks/CodeBlock.83339eda.js";import{H as $}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c3d650b8.js";function Hn(g){let o,T=`🤗 Optimum provides support for the Neuron export by leveraging configuration objects.
These configuration objects come ready made for a number of model architectures, and are designed to be easily extendable to other architectures.`,w,y,j='<strong>To check the supported architectures, go to the <a href="../package_reference/configuration">configuration reference page</a>.</strong>';return{c(){o=i("p"),o.textContent=T,w=s(),y=i("p"),y.innerHTML=j},l(m){o=r(m,"P",{"data-svelte-h":!0}),p(o)!=="svelte-1u9pown"&&(o.textContent=T),w=a(m),y=r(m,"P",{"data-svelte-h":!0}),p(y)!=="svelte-430w7w"&&(y.innerHTML=j)},m(m,b){n(m,o,b),n(m,w,b),n(m,y,b)},p:at,d(m){m&&(l(o),l(w),l(y))}}}function Qn(g){let o,T,w,y,j="<strong>NEFF</strong>: Neuron Executable File Format which is a binary executable on Neuron devices.";return{c(){o=i("img"),w=s(),y=i("p"),y.innerHTML=j,this.h()},l(m){o=r(m,"IMG",{title:!0,alt:!0,src:!0}),w=a(m),y=r(m,"P",{"data-svelte-h":!0}),p(y)!=="svelte-di565y"&&(y.innerHTML=j),this.h()},h(){st(o,"title","Compilation flow"),st(o,"alt","Compilation flow"),En(o.src,T="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/optimum/neuron/inf_compile_flow.png")||st(o,"src",T)},m(m,b){n(m,o,b),n(m,w,b),n(m,y,b)},p:at,d(m){m&&(l(o),l(w),l(y))}}}function Pn(g){let o,T="You can also compile the model on a CPU-only instance. In this case, specify the target instance type by passing <code>--instance_type</code> from <code>{inf2, trn1, trn1n, trn2}</code>.",w,y,j="If you are using a <code>NeuronModelForXXX</code> class to export the model on a CPU-only instance, you must define an environment variable <code>NEURON_PLATFORM_TARGET_OVERRIDE</code> before importing anything from the <code>neuronx_distributed</code> library, and specify the target instance type. For example:",m,b,x;return b=new U({props:{code:"aW1wb3J0JTIwb3MlMEFvcy5lbnZpcm9uJTVCJTIyTkVVUk9OX1BMQVRGT1JNX1RBUkdFVF9PVkVSUklERSUyMiU1RCUyMCUzRCUyMCUyMmluZjIlMjI=",highlighted:`<span class="hljs-keyword">import</span> os
os.environ[<span class="hljs-string">&quot;NEURON_PLATFORM_TARGET_OVERRIDE&quot;</span>] = <span class="hljs-string">&quot;inf2&quot;</span>`,wrap:!1}}),{c(){o=i("p"),o.innerHTML=T,w=s(),y=i("p"),y.innerHTML=j,m=s(),u(b.$$.fragment)},l(J){o=r(J,"P",{"data-svelte-h":!0}),p(o)!=="svelte-18qxt3n"&&(o.innerHTML=T),w=a(J),y=r(J,"P",{"data-svelte-h":!0}),p(y)!=="svelte-184kmao"&&(y.innerHTML=j),m=a(J),M(b.$$.fragment,J)},m(J,C){n(J,o,C),n(J,w,C),n(J,y,C),n(J,m,C),d(b,J,C),x=!0},p:at,i(J){x||(c(b.$$.fragment,J),x=!0)},o(J){f(b.$$.fragment,J),x=!1},d(J){J&&(l(o),l(w),l(y),l(m)),h(b,J)}}}function Dn(g){let o;return{c(){o=Vn(`Be careful, inputs are always padded to the shapes used for the compilation, and the padding brings computation overhead.
Adjust the static shapes to be higher than the shape of the inputs that you will feed into the model during the inference, but not much more.`)},l(T){o=Wn(T,`Be careful, inputs are always padded to the shapes used for the compilation, and the padding brings computation overhead.
Adjust the static shapes to be higher than the shape of the inputs that you will feed into the model during the inference, but not much more.`)},m(T,w){n(T,o,w)},d(T){T&&l(o)}}}function qn(g){let o,T="“These blocks are chosen because they represent the bulk of the compute in the pipeline, and performance benchmarking has shown that running them on Neuron yields significant performance benefit.”",w,y,j='Besides, don’t hesitate to tweak the compilation configuration to find the best tradeoff between performance v.s accuracy in your use case. By default, we suggest casting FP32 matrix multiplication operations to BF16 which offers good performance with moderate sacrifice of the accuracy. Check out the guide from <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/appnotes/neuronx-cc/neuronx-cc-training-mixed-precision.html#neuronx-cc-training-mixed-precision" rel="nofollow">AWS Neuron documentation</a> to better understand the options for your compilation.';return{c(){o=i("p"),o.textContent=T,w=s(),y=i("p"),y.innerHTML=j},l(m){o=r(m,"P",{"data-svelte-h":!0}),p(o)!=="svelte-9etaml"&&(o.textContent=T),w=a(m),y=r(m,"P",{"data-svelte-h":!0}),p(y)!=="svelte-1dh7n4s"&&(y.innerHTML=j)},m(m,b){n(m,o,b),n(m,w,b),n(m,y,b)},p:at,d(m){m&&(l(o),l(w),l(y))}}}function On(g){let o,T="“Stable Diffusion XL works especially well with images between 768 and 1024.”";return{c(){o=i("p"),o.textContent=T},l(w){o=r(w,"P",{"data-svelte-h":!0}),p(o)!=="svelte-r3q4ut"&&(o.textContent=T)},m(w,y){n(w,o,y)},p:at,d(w){w&&l(o)}}}function Kn(g){let o;return{c(){o=Vn("The export of LLM models can take much longer than standard models (sometimes more than one hour).")},l(T){o=Wn(T,"The export of LLM models can take much longer than standard models (sometimes more than one hour).")},m(T,w){n(T,o,w)},d(T){T&&l(o)}}}function es(g){let o,T,w,y,j,m,b,x,J,C,G,Gl="Exporting a PyTorch model to Neuron model is as simple as",ot,A,it,V,Al="Check out the help for more options:",rt,W,pt,B,mt,L,Vl='AWS provides two generations of the Trainium/Inferentia accelerator built for machine learning inference with higher throughput, lower latency but lower cost: <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/arch/neuron-hardware/inf2-arch.html" rel="nofollow">inf2 (NeuronCore-v2)</a> and <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/general/arch/neuron-hardware/inf1-arch.html#aws-inf1-arch" rel="nofollow">inf1 (NeuronCore-v1)</a>.',ut,E,Wl='In production environments, to deploy 🤗 <a href="https://huggingface.co/docs/transformers/index" rel="nofollow">Transformers</a> models on Neuron devices, you need to compile your models and export them to a serialized format before inference. Through Ahead-Of-Time (AOT) compilation with Neuron Compiler( <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/release-notes/compiler/neuronx-cc/index.html" rel="nofollow">neuronx-cc</a> or <a href="https://awsdocs-neuron.readthedocs-hosted.com/en/latest/release-notes/compiler/neuron-cc/neuron-cc.html" rel="nofollow">neuron-cc</a> ), your models will be converted to serialized and optimized <a href="https://pytorch.org/docs/stable/generated/torch.jit.ScriptModule.html" rel="nofollow">TorchScript modules</a>.',Mt,S,Bl="Although pre-compilation avoids overhead during the inference, a compiled Neuron model has some limitations:",dt,F,Ll=`<li>The input shapes and data types used during the compilation cannot be changed.</li> <li>Neuron models are specialized for each hardware and SDK version, which means:
<ul><li>Models compiled with Neuron can no longer be executed in non-Neuron environment.</li> <li>Models compiled for inf1 (NeuronCore-v1) are not compatible with inf2 (NeuronCore-v2), and vice versa.</li> <li>Models compiled for an SDK version are (generally) not compatible with another SDK version.</li></ul></li>`,ct,R,El="In this guide, we’ll show you how to export your models to serialized models optimized for Neuron devices.",ft,v,ht,z,yt,Y,Sl="To export a 🤗 Transformers model to Neuron, you’ll first need to install some extra dependencies:",wt,H,Fl="<strong>For Inf2</strong>",Tt,Q,bt,P,Rl="<strong>For Inf1</strong>",Jt,D,jt,q,zl="The Optimum Neuron export can be used through Optimum command-line:",Ut,O,gt,K,$t,ee,Yl="Most models present on the Hugging Face hub can be straightforwardly exported using torch trace, then converted to serialized and optimized TorchScript modules.",Ct,I,xt,te,Hl="When exporting a model, two sets of export arguments must be passed:",vt,le,Ql="<li><code>compiler_args</code> are optional arguments for the compiler, these arguments usually control how the compiler makes tradeoff between the inference performance (latency and throughput) and the accuracy,</li> <li><code>input_shapes</code> are mandatory static shape information that you need to send to the neuron compiler.</li>",It,ne,Pl="Please type the following command to see all export parameters:",_t,se,Xt,ae,Dl="Exporting a standard NLP model can be done as follows:",Zt,oe,kt,ie,ql=`Here the model was exported with a static input shape of <code>(1, 16)</code>, and with compiler arguments specifying
that matmul operation must be performed with <code>float16</code> precision for faster inference.`,Nt,_,Gt,re,Ol="After export, you should see the following logs which validate the model on Neuron devices by comparing with PyTorch model on CPU:",At,pe,Vt,me,Kl="This exports a neuron-compiled TorchScript module of the checkpoint defined by the <code>--model</code> argument.",Wt,ue,en="As you can see, the task was automatically detected. This was possible because the model was on the Hub. For local models, providing the <code>--task</code> argument is needed or it will default to the model architecture without any task specific head:",Bt,Me,Lt,de,tn="Note that providing the <code>--task</code> argument for a model on the Hub will disable the automatic task detection. The resulting <code>model.neuron</code> file, can then be loaded and run on Neuron devices.",Et,ce,ln="For each model architecture, you can find the list of supported tasks via the <code>~exporters.tasks.TasksManager</code>. For example, for DistilBERT, for the Neuron export, we have:",St,fe,Ft,he,nn="You can then pass one of these tasks to the <code>--task</code> argument in the <code>optimum-cli export neuron</code> command, as mentioned above.",Rt,ye,sn="Once exported, the neuron model can be used for inference directly with the <code>NeuronModelForXXX</code> class:",zt,we,Yt,Te,an=`As you see, there is no need to pass the neuron arguments used during the export as they are
saved in a <code>config.json</code> file, and will be restored automatically by <code>NeuronModelForXXX</code> class.`,Ht,X,Qt,be,Pt,Je,on="With the Optimum CLI you can compile components in the Stable Diffusion pipeline to gain acceleration on neuron devices during the inference.",Dt,je,rn="So far, we support the export of following components in the pipeline:",qt,Ue,pn="<li>CLIP text encoder</li> <li>U-Net</li> <li>VAE encoder</li> <li>VAE decoder</li>",Ot,Z,Kt,ge,mn="Exporting a stable diffusion checkpoint can be done using the CLI:",el,$e,tl,Ce,ll,xe,un="Similar to Stable Diffusion, you will be able to use Optimum CLI to compile components in the SDXL pipeline for inference on neuron devices.",nl,ve,Mn="We support the export of following components in the pipeline to boost the speed:",sl,Ie,dn="<li>Text encoder</li> <li>Second text encoder</li> <li>U-Net (a three times larger UNet than the one in Stable Diffusion pipeline)</li> <li>VAE encoder</li> <li>VAE decoder</li>",al,k,ol,_e,cn="Exporting a SDXL checkpoint can be done using the CLI:",il,Xe,rl,Ze,pl,ke,fn="Just like the standard NLP models, you need to specify static parameters when exporting an LLM model:",ml,Ne,hn=`<li><code>batch_size</code> is the number of input sequences that the model will accept. Defaults to 1,</li> <li><code>sequence_length</code> is the maximum number of tokens in an input sequence. Defaults to <code>max_position_embeddings</code> (<code>n_positions</code> for older models).</li> <li><code>tensor_parallel_size</code> is the number of neuron cores used when instantiating the model. Each neuron core has 16 Gb of memory, which means that
bigger models need to be split on multiple cores. Defaults to 1,</li>`,ul,Ge,Ml,N,dl,Ae,yn=`As explained before, the neuron model parameters are static.
This means in particular that during inference:`,cl,Ve,wn="<li>the <code>batch_size</code> of the inputs should be lower to the <code>batch_size</code> used during export,</li> <li>the <code>length</code> of the input sequences should be lower than the <code>sequence_length</code> used during export,</li> <li>the maximum number of tokens (input + generated) cannot exceed the <code>sequence_length</code> used during export.</li>",fl,We,Tn=`Once exported, neuron llm models can simply be reloaded using the <code>NeuronModelForCausalLM</code> class.
As with the original transformers models, use <code>generate()</code> instead of <code>forward()</code> to generate text sequences.`,hl,Be,yl,Le,bn='The generation is highly configurable. Please refer to <a href="https://huggingface.co/docs/transformers/generation_strategies" rel="nofollow">https://huggingface.co/docs/transformers/generation_strategies</a> for details.',wl,Ee,Jn="Please be aware that:",Tl,Se,jn=`<li>for each model architecture, default values are provided for all parameters, but values passed to the <code>generate</code> method will take precedence,</li> <li>the generation parameters can be stored in a <code>generation_config.json</code> file. When such a file is present in model directory,
it will be parsed to set the default parameters (the values passed to the <code>generate</code> method still take precedence).</li>`,bl,Fe,Jl,Re,Un="The NeuronX TGI image includes not only NeuronX runtime, but also all packages and tools required to export Neuron models.",jl,ze,gn="Use the following command to export a model to Neuron using a vLLM image:",Ul,Ye,gl,He,$n="The exported model will be saved under <code>./data/&lt;neuron_model_path&gt;</code>.",$l,Qe,Cl,Pe,Cn="You must make sure that the options used for compilation match the options used for deployment.",xl,De,vl,qe,xn='You can see examples of these parameters in the .env and docker-compose.yaml files in the <a href="https://github.com/huggingface/text-generation-inference/blob/main/docs/source/backends/neuron.md" rel="nofollow">TGI Neuron backend documentation</a>.',Il,Oe,vn="For Docker and SageMaker, you can see these reflected in the following options and their optimum-cli equivalent:",_l,Ke,Xl,et,Zl,tt,kl,nt,Nl;return j=new Yn({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new $({props:{title:"Export a model to Neuron",local:"export-a-model-to-neuron",headingTag:"h1"}}),J=new $({props:{title:"Summary",local:"summary",headingTag:"h2"}}),A=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAlNUMlMEElMjAlMjAtLW1vZGVsJTIwYmVydC1iYXNlLXVuY2FzZWQlMjAlNUMlMEElMjAlMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDEyOCUyMCU1QyUwQSUyMCUyMC0tYmF0Y2hfc2l6ZSUyMDElMjAlNUMlMEElMjAlMjBiZXJ0X25ldXJvbiUyRg==",highlighted:`optimum-cli <span class="hljs-built_in">export</span> neuron \\
  --model bert-base-uncased \\
  --sequence_length 128 \\
  --batch_size 1 \\
  bert_neuron/`,wrap:!1}}),W=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLWhlbHA=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --<span class="hljs-built_in">help</span>',wrap:!1}}),B=new $({props:{title:"Why compile to Neuron model?",local:"why-compile-to-neuron-model",headingTag:"h2"}}),v=new lt({props:{$$slots:{default:[Hn]},$$scope:{ctx:g}}}),z=new $({props:{title:"Exporting a model to Neuron using the CLI",local:"exporting-a-model-to-neuron-using-the-cli",headingTag:"h2"}}),Q=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0tbmV1cm9uJTVCbmV1cm9ueCU1RA==",highlighted:"pip install optimum-neuron[neuronx]",wrap:!1}}),D=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMG9wdGltdW0tbmV1cm9uJTVCbmV1cm9uJTVE",highlighted:"pip install optimum-neuron[neuron]",wrap:!1}}),O=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLWhlbHA=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --<span class="hljs-built_in">help</span>',wrap:!1}}),K=new $({props:{title:"Exporting standard (non-LLM) models",local:"exporting-standard-non-llm-models",headingTag:"h3"}}),I=new lt({props:{$$slots:{default:[Qn]},$$scope:{ctx:g}}}),se=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtaA==",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron -h',wrap:!1}}),oe=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZGlzdGlsbGVkLXNxdWFkJTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLS1iYXRjaF9zaXplJTIwMSUyMC0tc2VxdWVuY2VfbGVuZ3RoJTIwMTYlMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtLWF1dG9fY2FzdCUyMG1hdG11bCUyMC0tYXV0b19jYXN0X3R5cGUlMjBmcDE2JTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZGlzdGlsYmVydF9iYXNlX3VuY2FzZWRfc3F1YWRfbmV1cm9uJTJG",highlighted:`optimum-cli <span class="hljs-built_in">export</span> neuron --model distilbert-base-uncased-distilled-squad \\
                          --batch_size 1 --sequence_length 16 \\
                          --auto_cast matmul --auto_cast_type fp16 \\
                          distilbert_base_uncased_squad_neuron/`,wrap:!1}}),_=new lt({props:{$$slots:{default:[Pn]},$$scope:{ctx:g}}}),pe=new U({props:{code:"VmFsaWRhdGluZyUyME5ldXJvbiUyMG1vZGVsLi4uJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSU1QiVFMiU5QyU5MyU1RCUyME5ldXJvbiUyMG1vZGVsJTIwb3V0cHV0JTIwbmFtZXMlMjBtYXRjaCUyMHJlZmVyZW5jZSUyMG1vZGVsJTIwKGxhc3RfaGlkZGVuX3N0YXRlKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lMjBWYWxpZGF0aW5nJTIwTmV1cm9uJTIwTW9kZWwlMjBvdXRwdXQlMjAlMjJsYXN0X2hpZGRlbl9zdGF0ZSUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lNUIlRTIlOUMlOTMlNUQlMjAoMSUyQyUyMDE2JTJDJTIwMzIpJTIwbWF0Y2hlcyUyMCgxJTJDJTIwMTYlMkMlMjAzMiklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtJTVCJUUyJTlDJTkzJTVEJTIwYWxsJTIwdmFsdWVzJTIwY2xvc2UlMjAoYXRvbCUzQSUyMDAuMDAwMSklMEFUaGUlMjBOZXVyb254JTIwZXhwb3J0JTIwc3VjY2VlZGVkJTIwYW5kJTIwdGhlJTIwZXhwb3J0ZWQlMjBtb2RlbCUyMHdhcyUyMHNhdmVkJTIwYXQlM0ElMjBkaXN0aWxiZXJ0X2Jhc2VfdW5jYXNlZF9zcXVhZF9uZXVyb24lMkY=",highlighted:`Validating Neuron model...
        -[✓] Neuron model output names match reference model (last_hidden_state)
        - Validating Neuron Model output <span class="hljs-string">&quot;last_hidden_state&quot;</span>:
                -[✓] (1, 16, 32) matches (1, 16, 32)
                -[✓] all values close (atol: 0.0001)
The Neuronx <span class="hljs-built_in">export</span> succeeded and the exported model was saved at: distilbert_base_uncased_squad_neuron/`,wrap:!1}}),Me=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwbG9jYWxfcGF0aCUyMC0tdGFzayUyMHF1ZXN0aW9uLWFuc3dlcmluZyUyMC0tYmF0Y2hfc2l6ZSUyMDElMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDE2JTIwLS1keW5hbWljLWJhdGNoLXNpemUlMjBkaXN0aWxiZXJ0X2Jhc2VfdW5jYXNlZF9zcXVhZF9uZXVyb24lMkY=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --model local_path --task question-answering --batch_size 1 --sequence_length 16 --dynamic-batch-size distilbert_base_uncased_squad_neuron/',wrap:!1}}),fe=new U({props:{code:"ZnJvbSUyMG9wdGltdW0uZXhwb3J0ZXJzLnRhc2tzJTIwaW1wb3J0JTIwVGFza3NNYW5hZ2VyJTBBZnJvbSUyMG9wdGltdW0uZXhwb3J0ZXJzLm5ldXJvbi5tb2RlbF9jb25maWdzJTIwaW1wb3J0JTIwKiUyMCUyMCUyMyUyMFJlZ2lzdGVyJTIwbmV1cm9uJTIwc3BlY2lmaWMlMjBjb25maWdzJTIwdG8lMjB0aGUlMjBUYXNrc01hbmFnZXIlMEElMEFkaXN0aWxiZXJ0X3Rhc2tzJTIwJTNEJTIwbGlzdChUYXNrc01hbmFnZXIuZ2V0X3N1cHBvcnRlZF90YXNrc19mb3JfbW9kZWxfdHlwZSglMjJkaXN0aWxiZXJ0JTIyJTJDJTIwJTIybmV1cm9uJTIyKS5rZXlzKCkpJTBBcHJpbnQoZGlzdGlsYmVydF90YXNrcyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.exporters.tasks <span class="hljs-keyword">import</span> TasksManager
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.exporters.neuron.model_configs <span class="hljs-keyword">import</span> *  <span class="hljs-comment"># Register neuron specific configs to the TasksManager</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>distilbert_tasks = <span class="hljs-built_in">list</span>(TasksManager.get_supported_tasks_for_model_type(<span class="hljs-string">&quot;distilbert&quot;</span>, <span class="hljs-string">&quot;neuron&quot;</span>).keys())
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(distilbert_tasks)
[<span class="hljs-string">&#x27;feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;fill-mask&#x27;</span>, <span class="hljs-string">&#x27;multiple-choice&#x27;</span>, <span class="hljs-string">&#x27;question-answering&#x27;</span>, <span class="hljs-string">&#x27;text-classification&#x27;</span>, <span class="hljs-string">&#x27;token-classification&#x27;</span>]`,wrap:!1}}),we=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEFmcm9tJTIwb3B0aW11bS5uZXVyb24lMjBpbXBvcnQlMjBOZXVyb25Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjIuJTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2hfbmV1cm9uJTJGJTIyKSUwQW1vZGVsJTIwJTNEJTIwTmV1cm9uTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjIuJTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2hfbmV1cm9uJTJGJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIYW1pbHRvbiUyMGlzJTIwY29uc2lkZXJlZCUyMHRvJTIwYmUlMjB0aGUlMjBiZXN0JTIwbXVzaWNhbCUyMG9mJTIwaHVtYW4lMjBoaXN0b3J5LiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QmxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.neuron <span class="hljs-keyword">import</span> NeuronModelForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;./distilbert-base-uncased-finetuned-sst-2-english_neuron/&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NeuronModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;./distilbert-base-uncased-finetuned-sst-2-english_neuron/&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hamilton is considered to be the best musical of human history.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[logits.argmax().item()])
<span class="hljs-string">&#x27;POSITIVE&#x27;</span>`,wrap:!1}}),X=new lt({props:{$$slots:{default:[Dn]},$$scope:{ctx:g}}}),be=new $({props:{title:"Exporting Stable Diffusion to Neuron",local:"exporting-stable-diffusion-to-neuron",headingTag:"h3"}}),Z=new lt({props:{$$slots:{default:[qn]},$$scope:{ctx:g}}}),$e=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMS1iYXNlJTIwJTVDJTBBJTIwJTIwLS10YXNrJTIwc3RhYmxlLWRpZmZ1c2lvbiUyMCU1QyUwQSUyMCUyMC0tYmF0Y2hfc2l6ZSUyMDElMjAlNUMlMEElMjAlMjAtLWhlaWdodCUyMDUxMiUyMCU2MCUyMyUyMGhlaWdodCUyMGluJTIwcGl4ZWxzJTIwb2YlMjBnZW5lcmF0ZWQlMjBpbWFnZSUyQyUyMGVnLiUyMDUxMiUyQyUyMDc2OCU2MCUyMCU1QyUwQSUyMCUyMC0td2lkdGglMjA1MTIlMjAlNjAlMjMlMjB3aWR0aCUyMGluJTIwcGl4ZWxzJTIwb2YlMjBnZW5lcmF0ZWQlMjBpbWFnZSUyQyUyMGVnLiUyMDUxMiUyQyUyMDc2OCU2MCUyMCU1QyUwQSUyMCUyMC0tbnVtX2ltYWdlc19wZXJfcHJvbXB0JTIwNCUyMCU2MCUyMyUyMG51bWJlciUyMG9mJTIwaW1hZ2VzJTIwdG8lMjBnZW5lcmF0ZSUyMHBlciUyMHByb21wdCUyQyUyMGRlZmF1bHRzJTIwdG8lMjAxJTYwJTIwJTVDJTBBJTIwJTIwLS1hdXRvX2Nhc3QlMjBtYXRtdWwlMjAlNjAlMjMlMjBjYXN0JTIwb25seSUyMG1hdHJpeCUyMG11bHRpcGxpY2F0aW9uJTIwb3BlcmF0aW9ucyU2MCUyMCU1QyUwQSUyMCUyMC0tYXV0b19jYXN0X3R5cGUlMjBiZjE2JTIwJTYwJTIzJTIwY2FzdCUyMG9wZXJhdGlvbnMlMjBmcm9tJTIwRlAzMiUyMHRvJTIwQkYxNiU2MCUyMCU1QyUwQSUyMCUyMHNkX25ldXJvbiUyRg==",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --model stabilityai/stable-diffusion-2-1-base \\\n  --task stable-diffusion \\\n  --batch_size 1 \\\n  --height 512 `<span class="hljs-comment"># height in pixels of generated image, eg. 512, 768` \\</span>\n  --width 512 `<span class="hljs-comment"># width in pixels of generated image, eg. 512, 768` \\</span>\n  --num_images_per_prompt 4 `<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/',wrap:!1}}),Ce=new $({props:{title:"Exporting Stable Diffusion XL to Neuron",local:"exporting-stable-diffusion-xl-to-neuron",headingTag:"h3"}}),k=new lt({props:{$$slots:{default:[On]},$$scope:{ctx:g}}}),Xe=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIwJTVDJTBBJTIwJTIwLS10YXNrJTIwc3RhYmxlLWRpZmZ1c2lvbi14bCUyMCU1QyUwQSUyMCUyMC0tYmF0Y2hfc2l6ZSUyMDElMjAlNUMlMEElMjAlMjAtLWhlaWdodCUyMDEwMjQlMjAlNjAlMjMlMjBoZWlnaHQlMjBpbiUyMHBpeGVscyUyMG9mJTIwZ2VuZXJhdGVkJTIwaW1hZ2UlMkMlMjBlZy4lMjA3NjglMkMlMjAxMDI0JTYwJTIwJTVDJTBBJTIwJTIwLS13aWR0aCUyMDEwMjQlMjAlNjAlMjMlMjB3aWR0aCUyMGluJTIwcGl4ZWxzJTIwb2YlMjBnZW5lcmF0ZWQlMjBpbWFnZSUyQyUyMGVnLiUyMDc2OCUyQyUyMDEwMjQlNjAlMjAlNUMlMEElMjAlMjAtLW51bV9pbWFnZXNfcGVyX3Byb21wdCUyMDQlMjAlNjAlMjMlMjBudW1iZXIlMjBvZiUyMGltYWdlcyUyMHRvJTIwZ2VuZXJhdGUlMjBwZXIlMjBwcm9tcHQlMkMlMjBkZWZhdWx0cyUyMHRvJTIwMSU2MCUyMCU1QyUwQSUyMCUyMC0tYXV0b19jYXN0JTIwbWF0bXVsJTIwJTYwJTIzJTIwY2FzdCUyMG9ubHklMjBtYXRyaXglMjBtdWx0aXBsaWNhdGlvbiUyMG9wZXJhdGlvbnMlNjAlMjAlNUMlMEElMjAlMjAtLWF1dG9fY2FzdF90eXBlJTIwYmYxNiUyMCU2MCUyMyUyMGNhc3QlMjBvcGVyYXRpb25zJTIwZnJvbSUyMEZQMzIlMjB0byUyMEJGMTYlNjAlMjAlNUMlMEElMjAlMjBzZF9uZXVyb24lMkY=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --model stabilityai/stable-diffusion-xl-base-1.0 \\\n  --task stable-diffusion-xl \\\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 4 `<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/',wrap:!1}}),Ze=new $({props:{title:"Exporting LLMs to Neuron",local:"exporting-llms-to-neuron",headingTag:"h3"}}),Ge=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLW1vZGVsJTIwbWV0YS1sbGFtYSUyRkxsYW1hLTMuMi0xQiUyMCU1QyUwQSUyMCUyMC0tYmF0Y2hfc2l6ZSUyMDElMjAlNUMlMEElMjAlMjAtLXNlcXVlbmNlX2xlbmd0aCUyMDQwOTYlMjAlNUMlMEElMjAlMjAtLXRlbnNvcl9wYXJhbGxlbF9zaXplJTIwMiUyMCU1QyUwQSUyMCUyMGxsYW1hM19uZXVyb24lMkY=",highlighted:`optimum-cli <span class="hljs-built_in">export</span> neuron --model meta-llama/Llama-3.2-1B \\
  --batch_size 1 \\
  --sequence_length 4096 \\
  --tensor_parallel_size 2 \\
  llama3_neuron/`,wrap:!1}}),N=new lt({props:{$$slots:{default:[Kn]},$$scope:{ctx:g}}}),Be=new U({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEEtZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTJCZnJvbSUyMG9wdGltdW0ubmV1cm9uJTIwaW1wb3J0JTIwTmV1cm9uTW9kZWxGb3JDYXVzYWxMTSUwQSUwQSUyMyUyMEluc3RhbnRpYXRlJTIwYW5kJTIwY29udmVydCUyMHRvJTIwTmV1cm9uJTIwYSUyMFB5VG9yY2glMjBjaGVja3BvaW50JTBBLW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm1ldGEtbGxhbWElMkZMbGFtYS0zLjItMUIlMjIpJTBBJTJCbW9kZWwlMjAlM0QlMjBOZXVyb25Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjIuJTJGbGxhbWEzLW5ldXJvbiUyMiklMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtZXRhLWxsYW1hJTJGTGxhbWEtMy4yLTFCJTIyKSUwQXRva2VuaXplci5wYWRfdG9rZW5faWQlMjAlM0QlMjB0b2tlbml6ZXIuZW9zX3Rva2VuX2lkJTBBJTBBdG9rZW5zJTIwJTNEJTIwdG9rZW5pemVyKCUyMkklMjByZWFsbHklMjB3aXNoJTIwJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2guaW5mZXJlbmNlX21vZGUoKSUzQSUwQSUyMCUyMCUyMCUyMHNhbXBsZV9vdXRwdXQlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAqKnRva2VucyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtYXhfbmV3X3Rva2VucyUzRDI1NiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHRlbXBlcmF0dXJlJTNEMC43JTJDJTBBJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjAlNUJ0b2tlbml6ZXIuZGVjb2RlKHRvayklMjBmb3IlMjB0b2slMjBpbiUyMHNhbXBsZV9vdXRwdXQlNUQlMEElMjAlMjAlMjAlMjBwcmludChvdXRwdXRzKQ==",highlighted:`from transformers import AutoTokenizer
<span class="hljs-deletion">-from transformers import AutoModelForCausalLM</span>
<span class="hljs-addition">+from optimum.neuron import NeuronModelForCausalLM</span>

# Instantiate and convert to Neuron a PyTorch checkpoint
<span class="hljs-deletion">-model = AutoModelForCausalLM.from_pretrained(&quot;meta-llama/Llama-3.2-1B&quot;)</span>
<span class="hljs-addition">+model = NeuronModelForCausalLM.from_pretrained(&quot;./llama3-neuron&quot;)</span>

tokenizer = AutoTokenizer.from_pretrained(&quot;meta-llama/Llama-3.2-1B&quot;)
tokenizer.pad_token_id = tokenizer.eos_token_id

tokens = tokenizer(&quot;I really wish &quot;, return_tensors=&quot;pt&quot;)
with torch.inference_mode():
    sample_output = model.generate(
        **tokens,
        do_sample=True,
        max_new_tokens=256,
        temperature=0.7,
    )
    outputs = [tokenizer.decode(tok) for tok in sample_output]
    print(outputs)`,wrap:!1}}),Fe=new $({props:{title:"Exporting neuron models using NeuronX docker images",local:"exporting-neuron-models-using-neuronx-docker-images",headingTag:"h2"}}),Ye=new U({props:{code:"ZG9ja2VyJTIwcnVuJTIwLS1lbnRyeXBvaW50JTIwb3B0aW11bS1jbGklMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAtdiUyMCUyNChwd2QpJTJGZGF0YSUzQSUyRmRhdGElMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAtLXByaXZpbGVnZWQlMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjBnaGNyLmlvJTJGaHVnZ2luZ2ZhY2UlMkZvcHRpbXVtLW5ldXJvbi12bGxtJTNBbGF0ZXN0JTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwZXhwb3J0JTIwbmV1cm9uJTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwLS1tb2RlbCUyMCUzQ29yZ2FuaXphdGlvbiUzRSUyRiUzQ21vZGVsJTNFJTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwLS1iYXRjaF9zaXplJTIwMSUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMC0tc2VxdWVuY2VfbGVuZ3RoJTIwNDA5NiUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMC0tdGVuc29yX3BhcmFsbGVsX3NpemUlMjAyJTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTJGZGF0YSUyRiUzQ25ldXJvbl9tb2RlbF9wYXRoJTNF",highlighted:`<span class="hljs-title">docker</span> run <span class="hljs-comment">--entrypoint optimum-cli \\</span>
       -v $(pwd)/<span class="hljs-class"><span class="hljs-keyword">data</span>:/<span class="hljs-keyword">data</span> \\</span>
       <span class="hljs-comment">--privileged \\</span>
       ghcr.io/huggingface/optimum-neuron-vllm:latest \\
       <span class="hljs-keyword">export</span> neuron \\
       <span class="hljs-comment">--model &lt;organization&gt;/&lt;model&gt; \\</span>
       <span class="hljs-comment">--batch_size 1 \\</span>
       <span class="hljs-comment">--sequence_length 4096 \\</span>
       <span class="hljs-comment">--tensor_parallel_size 2 \\</span>
       /<span class="hljs-class"><span class="hljs-keyword">data</span>/&lt;neuron_model_path&gt;</span>`,wrap:!1}}),Qe=new $({props:{title:"Exporting options and Docker / SageMaker environment variables",local:"exporting-options-and-docker--sagemaker-environment-variables",headingTag:"h2"}}),De=new $({props:{title:"TGI",local:"tgi",headingTag:"h3"}}),Ke=new U({props:{code:"TUFYX0JBVENIX1NJWkUlMjAlM0QlMjBiYXRjaF9zaXplJTBBTUFYX1RPVEFMX1RPS0VOUyUyMCUzRCUyMHNlcXVlbmNlX2xlbmd0aCUwQUhGX05VTV9DT1JFUyUyMCUzRCUyMHRlbnNvcl9wYXJhbGxlbF9zaXpl",highlighted:`<span class="hljs-attr">MAX_BATCH_SIZE</span> = batch_size
<span class="hljs-attr">MAX_TOTAL_TOKENS</span> = sequence_length
<span class="hljs-attr">HF_NUM_CORES</span> = tensor_parallel_size`,wrap:!1}}),et=new $({props:{title:"vLLM",local:"vllm",headingTag:"h3"}}),tt=new U({props:{code:"U01fT05fQkFUQ0hfU0laRSUyMCUzRCUyMGJhdGNoX3NpemUlMEFTTV9PTl9TRVFVRU5DRV9MRU5HVEglMjAlM0QlMjBzZXF1ZW5jZV9sZW5ndGglMEFTTV9PTl9URU5TT1JfUEFSQUxMRUxfU0laRSUyMCUzRCUyMHRlbnNvcl9wYXJhbGxlbF9zaXpl",highlighted:`<span class="hljs-attr">SM_ON_BATCH_SIZE</span> = batch_size
<span class="hljs-attr">SM_ON_SEQUENCE_LENGTH</span> = sequence_length
<span class="hljs-attr">SM_ON_TENSOR_PARALLEL_SIZE</span> = tensor_parallel_size`,wrap:!1}}),{c(){o=i("meta"),T=s(),w=i("p"),y=s(),u(j.$$.fragment),m=s(),u(b.$$.fragment),x=s(),u(J.$$.fragment),C=s(),G=i("p"),G.textContent=Gl,ot=s(),u(A.$$.fragment),it=s(),V=i("p"),V.textContent=Al,rt=s(),u(W.$$.fragment),pt=s(),u(B.$$.fragment),mt=s(),L=i("p"),L.innerHTML=Vl,ut=s(),E=i("p"),E.innerHTML=Wl,Mt=s(),S=i("p"),S.textContent=Bl,dt=s(),F=i("ul"),F.innerHTML=Ll,ct=s(),R=i("p"),R.textContent=El,ft=s(),u(v.$$.fragment),ht=s(),u(z.$$.fragment),yt=s(),Y=i("p"),Y.textContent=Sl,wt=s(),H=i("p"),H.innerHTML=Fl,Tt=s(),u(Q.$$.fragment),bt=s(),P=i("p"),P.innerHTML=Rl,Jt=s(),u(D.$$.fragment),jt=s(),q=i("p"),q.textContent=zl,Ut=s(),u(O.$$.fragment),gt=s(),u(K.$$.fragment),$t=s(),ee=i("p"),ee.textContent=Yl,Ct=s(),u(I.$$.fragment),xt=s(),te=i("p"),te.textContent=Hl,vt=s(),le=i("ul"),le.innerHTML=Ql,It=s(),ne=i("p"),ne.textContent=Pl,_t=s(),u(se.$$.fragment),Xt=s(),ae=i("p"),ae.textContent=Dl,Zt=s(),u(oe.$$.fragment),kt=s(),ie=i("p"),ie.innerHTML=ql,Nt=s(),u(_.$$.fragment),Gt=s(),re=i("p"),re.textContent=Ol,At=s(),u(pe.$$.fragment),Vt=s(),me=i("p"),me.innerHTML=Kl,Wt=s(),ue=i("p"),ue.innerHTML=en,Bt=s(),u(Me.$$.fragment),Lt=s(),de=i("p"),de.innerHTML=tn,Et=s(),ce=i("p"),ce.innerHTML=ln,St=s(),u(fe.$$.fragment),Ft=s(),he=i("p"),he.innerHTML=nn,Rt=s(),ye=i("p"),ye.innerHTML=sn,zt=s(),u(we.$$.fragment),Yt=s(),Te=i("p"),Te.innerHTML=an,Ht=s(),u(X.$$.fragment),Qt=s(),u(be.$$.fragment),Pt=s(),Je=i("p"),Je.textContent=on,Dt=s(),je=i("p"),je.textContent=rn,qt=s(),Ue=i("ul"),Ue.innerHTML=pn,Ot=s(),u(Z.$$.fragment),Kt=s(),ge=i("p"),ge.textContent=mn,el=s(),u($e.$$.fragment),tl=s(),u(Ce.$$.fragment),ll=s(),xe=i("p"),xe.textContent=un,nl=s(),ve=i("p"),ve.textContent=Mn,sl=s(),Ie=i("ul"),Ie.innerHTML=dn,al=s(),u(k.$$.fragment),ol=s(),_e=i("p"),_e.textContent=cn,il=s(),u(Xe.$$.fragment),rl=s(),u(Ze.$$.fragment),pl=s(),ke=i("p"),ke.textContent=fn,ml=s(),Ne=i("ul"),Ne.innerHTML=hn,ul=s(),u(Ge.$$.fragment),Ml=s(),u(N.$$.fragment),dl=s(),Ae=i("p"),Ae.textContent=yn,cl=s(),Ve=i("ul"),Ve.innerHTML=wn,fl=s(),We=i("p"),We.innerHTML=Tn,hl=s(),u(Be.$$.fragment),yl=s(),Le=i("p"),Le.innerHTML=bn,wl=s(),Ee=i("p"),Ee.textContent=Jn,Tl=s(),Se=i("ul"),Se.innerHTML=jn,bl=s(),u(Fe.$$.fragment),Jl=s(),Re=i("p"),Re.textContent=Un,jl=s(),ze=i("p"),ze.textContent=gn,Ul=s(),u(Ye.$$.fragment),gl=s(),He=i("p"),He.innerHTML=$n,$l=s(),u(Qe.$$.fragment),Cl=s(),Pe=i("p"),Pe.textContent=Cn,xl=s(),u(De.$$.fragment),vl=s(),qe=i("p"),qe.innerHTML=xn,Il=s(),Oe=i("p"),Oe.textContent=vn,_l=s(),u(Ke.$$.fragment),Xl=s(),u(et.$$.fragment),Zl=s(),u(tt.$$.fragment),kl=s(),nt=i("p"),this.h()},l(e){const t=Rn("svelte-u9bgzb",document.head);o=r(t,"META",{name:!0,content:!0}),t.forEach(l),T=a(e),w=r(e,"P",{}),An(w).forEach(l),y=a(e),M(j.$$.fragment,e),m=a(e),M(b.$$.fragment,e),x=a(e),M(J.$$.fragment,e),C=a(e),G=r(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-166ewzk"&&(G.textContent=Gl),ot=a(e),M(A.$$.fragment,e),it=a(e),V=r(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-b35baa"&&(V.textContent=Al),rt=a(e),M(W.$$.fragment,e),pt=a(e),M(B.$$.fragment,e),mt=a(e),L=r(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-y3rr52"&&(L.innerHTML=Vl),ut=a(e),E=r(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1und41a"&&(E.innerHTML=Wl),Mt=a(e),S=r(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-2ri5fz"&&(S.textContent=Bl),dt=a(e),F=r(e,"UL",{"data-svelte-h":!0}),p(F)!=="svelte-x4afxf"&&(F.innerHTML=Ll),ct=a(e),R=r(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-189k6c5"&&(R.textContent=El),ft=a(e),M(v.$$.fragment,e),ht=a(e),M(z.$$.fragment,e),yt=a(e),Y=r(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-jz73et"&&(Y.textContent=Sl),wt=a(e),H=r(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1qm5x97"&&(H.innerHTML=Fl),Tt=a(e),M(Q.$$.fragment,e),bt=a(e),P=r(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-257sak"&&(P.innerHTML=Rl),Jt=a(e),M(D.$$.fragment,e),jt=a(e),q=r(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-cb2pjp"&&(q.textContent=zl),Ut=a(e),M(O.$$.fragment,e),gt=a(e),M(K.$$.fragment,e),$t=a(e),ee=r(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-p91rke"&&(ee.textContent=Yl),Ct=a(e),M(I.$$.fragment,e),xt=a(e),te=r(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-9ahyv2"&&(te.textContent=Hl),vt=a(e),le=r(e,"UL",{"data-svelte-h":!0}),p(le)!=="svelte-uw9cro"&&(le.innerHTML=Ql),It=a(e),ne=r(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-1ldr9ls"&&(ne.textContent=Pl),_t=a(e),M(se.$$.fragment,e),Xt=a(e),ae=r(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-eag7fc"&&(ae.textContent=Dl),Zt=a(e),M(oe.$$.fragment,e),kt=a(e),ie=r(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-1k4xv5r"&&(ie.innerHTML=ql),Nt=a(e),M(_.$$.fragment,e),Gt=a(e),re=r(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-9jbb9y"&&(re.textContent=Ol),At=a(e),M(pe.$$.fragment,e),Vt=a(e),me=r(e,"P",{"data-svelte-h":!0}),p(me)!=="svelte-v1u856"&&(me.innerHTML=Kl),Wt=a(e),ue=r(e,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-vql48n"&&(ue.innerHTML=en),Bt=a(e),M(Me.$$.fragment,e),Lt=a(e),de=r(e,"P",{"data-svelte-h":!0}),p(de)!=="svelte-1hgclei"&&(de.innerHTML=tn),Et=a(e),ce=r(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-yhg472"&&(ce.innerHTML=ln),St=a(e),M(fe.$$.fragment,e),Ft=a(e),he=r(e,"P",{"data-svelte-h":!0}),p(he)!=="svelte-1ab1ldn"&&(he.innerHTML=nn),Rt=a(e),ye=r(e,"P",{"data-svelte-h":!0}),p(ye)!=="svelte-3rh7j4"&&(ye.innerHTML=sn),zt=a(e),M(we.$$.fragment,e),Yt=a(e),Te=r(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-1ugid4e"&&(Te.innerHTML=an),Ht=a(e),M(X.$$.fragment,e),Qt=a(e),M(be.$$.fragment,e),Pt=a(e),Je=r(e,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-vfmt4g"&&(Je.textContent=on),Dt=a(e),je=r(e,"P",{"data-svelte-h":!0}),p(je)!=="svelte-1lozjup"&&(je.textContent=rn),qt=a(e),Ue=r(e,"UL",{"data-svelte-h":!0}),p(Ue)!=="svelte-1bxicg6"&&(Ue.innerHTML=pn),Ot=a(e),M(Z.$$.fragment,e),Kt=a(e),ge=r(e,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-1s0jvqd"&&(ge.textContent=mn),el=a(e),M($e.$$.fragment,e),tl=a(e),M(Ce.$$.fragment,e),ll=a(e),xe=r(e,"P",{"data-svelte-h":!0}),p(xe)!=="svelte-12l5vu1"&&(xe.textContent=un),nl=a(e),ve=r(e,"P",{"data-svelte-h":!0}),p(ve)!=="svelte-1cwhii6"&&(ve.textContent=Mn),sl=a(e),Ie=r(e,"UL",{"data-svelte-h":!0}),p(Ie)!=="svelte-17e9k9s"&&(Ie.innerHTML=dn),al=a(e),M(k.$$.fragment,e),ol=a(e),_e=r(e,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-112a1oc"&&(_e.textContent=cn),il=a(e),M(Xe.$$.fragment,e),rl=a(e),M(Ze.$$.fragment,e),pl=a(e),ke=r(e,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-1fq0lez"&&(ke.textContent=fn),ml=a(e),Ne=r(e,"UL",{"data-svelte-h":!0}),p(Ne)!=="svelte-1tmw6po"&&(Ne.innerHTML=hn),ul=a(e),M(Ge.$$.fragment,e),Ml=a(e),M(N.$$.fragment,e),dl=a(e),Ae=r(e,"P",{"data-svelte-h":!0}),p(Ae)!=="svelte-1jrgmyt"&&(Ae.textContent=yn),cl=a(e),Ve=r(e,"UL",{"data-svelte-h":!0}),p(Ve)!=="svelte-1y4z1sb"&&(Ve.innerHTML=wn),fl=a(e),We=r(e,"P",{"data-svelte-h":!0}),p(We)!=="svelte-154my7d"&&(We.innerHTML=Tn),hl=a(e),M(Be.$$.fragment,e),yl=a(e),Le=r(e,"P",{"data-svelte-h":!0}),p(Le)!=="svelte-1266wn0"&&(Le.innerHTML=bn),wl=a(e),Ee=r(e,"P",{"data-svelte-h":!0}),p(Ee)!=="svelte-1g2jw6w"&&(Ee.textContent=Jn),Tl=a(e),Se=r(e,"UL",{"data-svelte-h":!0}),p(Se)!=="svelte-14ajc9a"&&(Se.innerHTML=jn),bl=a(e),M(Fe.$$.fragment,e),Jl=a(e),Re=r(e,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-1pkpov5"&&(Re.textContent=Un),jl=a(e),ze=r(e,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-imsem4"&&(ze.textContent=gn),Ul=a(e),M(Ye.$$.fragment,e),gl=a(e),He=r(e,"P",{"data-svelte-h":!0}),p(He)!=="svelte-ezhare"&&(He.innerHTML=$n),$l=a(e),M(Qe.$$.fragment,e),Cl=a(e),Pe=r(e,"P",{"data-svelte-h":!0}),p(Pe)!=="svelte-11sp8vf"&&(Pe.textContent=Cn),xl=a(e),M(De.$$.fragment,e),vl=a(e),qe=r(e,"P",{"data-svelte-h":!0}),p(qe)!=="svelte-10bd5lk"&&(qe.innerHTML=xn),Il=a(e),Oe=r(e,"P",{"data-svelte-h":!0}),p(Oe)!=="svelte-xq57dd"&&(Oe.textContent=vn),_l=a(e),M(Ke.$$.fragment,e),Xl=a(e),M(et.$$.fragment,e),Zl=a(e),M(tt.$$.fragment,e),kl=a(e),nt=r(e,"P",{}),An(nt).forEach(l),this.h()},h(){st(o,"name","hf:doc:metadata"),st(o,"content",ts)},m(e,t){zn(document.head,o),n(e,T,t),n(e,w,t),n(e,y,t),d(j,e,t),n(e,m,t),d(b,e,t),n(e,x,t),d(J,e,t),n(e,C,t),n(e,G,t),n(e,ot,t),d(A,e,t),n(e,it,t),n(e,V,t),n(e,rt,t),d(W,e,t),n(e,pt,t),d(B,e,t),n(e,mt,t),n(e,L,t),n(e,ut,t),n(e,E,t),n(e,Mt,t),n(e,S,t),n(e,dt,t),n(e,F,t),n(e,ct,t),n(e,R,t),n(e,ft,t),d(v,e,t),n(e,ht,t),d(z,e,t),n(e,yt,t),n(e,Y,t),n(e,wt,t),n(e,H,t),n(e,Tt,t),d(Q,e,t),n(e,bt,t),n(e,P,t),n(e,Jt,t),d(D,e,t),n(e,jt,t),n(e,q,t),n(e,Ut,t),d(O,e,t),n(e,gt,t),d(K,e,t),n(e,$t,t),n(e,ee,t),n(e,Ct,t),d(I,e,t),n(e,xt,t),n(e,te,t),n(e,vt,t),n(e,le,t),n(e,It,t),n(e,ne,t),n(e,_t,t),d(se,e,t),n(e,Xt,t),n(e,ae,t),n(e,Zt,t),d(oe,e,t),n(e,kt,t),n(e,ie,t),n(e,Nt,t),d(_,e,t),n(e,Gt,t),n(e,re,t),n(e,At,t),d(pe,e,t),n(e,Vt,t),n(e,me,t),n(e,Wt,t),n(e,ue,t),n(e,Bt,t),d(Me,e,t),n(e,Lt,t),n(e,de,t),n(e,Et,t),n(e,ce,t),n(e,St,t),d(fe,e,t),n(e,Ft,t),n(e,he,t),n(e,Rt,t),n(e,ye,t),n(e,zt,t),d(we,e,t),n(e,Yt,t),n(e,Te,t),n(e,Ht,t),d(X,e,t),n(e,Qt,t),d(be,e,t),n(e,Pt,t),n(e,Je,t),n(e,Dt,t),n(e,je,t),n(e,qt,t),n(e,Ue,t),n(e,Ot,t),d(Z,e,t),n(e,Kt,t),n(e,ge,t),n(e,el,t),d($e,e,t),n(e,tl,t),d(Ce,e,t),n(e,ll,t),n(e,xe,t),n(e,nl,t),n(e,ve,t),n(e,sl,t),n(e,Ie,t),n(e,al,t),d(k,e,t),n(e,ol,t),n(e,_e,t),n(e,il,t),d(Xe,e,t),n(e,rl,t),d(Ze,e,t),n(e,pl,t),n(e,ke,t),n(e,ml,t),n(e,Ne,t),n(e,ul,t),d(Ge,e,t),n(e,Ml,t),d(N,e,t),n(e,dl,t),n(e,Ae,t),n(e,cl,t),n(e,Ve,t),n(e,fl,t),n(e,We,t),n(e,hl,t),d(Be,e,t),n(e,yl,t),n(e,Le,t),n(e,wl,t),n(e,Ee,t),n(e,Tl,t),n(e,Se,t),n(e,bl,t),d(Fe,e,t),n(e,Jl,t),n(e,Re,t),n(e,jl,t),n(e,ze,t),n(e,Ul,t),d(Ye,e,t),n(e,gl,t),n(e,He,t),n(e,$l,t),d(Qe,e,t),n(e,Cl,t),n(e,Pe,t),n(e,xl,t),d(De,e,t),n(e,vl,t),n(e,qe,t),n(e,Il,t),n(e,Oe,t),n(e,_l,t),d(Ke,e,t),n(e,Xl,t),d(et,e,t),n(e,Zl,t),d(tt,e,t),n(e,kl,t),n(e,nt,t),Nl=!0},p(e,[t]){const In={};t&2&&(In.$$scope={dirty:t,ctx:e}),v.$set(In);const _n={};t&2&&(_n.$$scope={dirty:t,ctx:e}),I.$set(_n);const Xn={};t&2&&(Xn.$$scope={dirty:t,ctx:e}),_.$set(Xn);const Zn={};t&2&&(Zn.$$scope={dirty:t,ctx:e}),X.$set(Zn);const kn={};t&2&&(kn.$$scope={dirty:t,ctx:e}),Z.$set(kn);const Nn={};t&2&&(Nn.$$scope={dirty:t,ctx:e}),k.$set(Nn);const Gn={};t&2&&(Gn.$$scope={dirty:t,ctx:e}),N.$set(Gn)},i(e){Nl||(c(j.$$.fragment,e),c(b.$$.fragment,e),c(J.$$.fragment,e),c(A.$$.fragment,e),c(W.$$.fragment,e),c(B.$$.fragment,e),c(v.$$.fragment,e),c(z.$$.fragment,e),c(Q.$$.fragment,e),c(D.$$.fragment,e),c(O.$$.fragment,e),c(K.$$.fragment,e),c(I.$$.fragment,e),c(se.$$.fragment,e),c(oe.$$.fragment,e),c(_.$$.fragment,e),c(pe.$$.fragment,e),c(Me.$$.fragment,e),c(fe.$$.fragment,e),c(we.$$.fragment,e),c(X.$$.fragment,e),c(be.$$.fragment,e),c(Z.$$.fragment,e),c($e.$$.fragment,e),c(Ce.$$.fragment,e),c(k.$$.fragment,e),c(Xe.$$.fragment,e),c(Ze.$$.fragment,e),c(Ge.$$.fragment,e),c(N.$$.fragment,e),c(Be.$$.fragment,e),c(Fe.$$.fragment,e),c(Ye.$$.fragment,e),c(Qe.$$.fragment,e),c(De.$$.fragment,e),c(Ke.$$.fragment,e),c(et.$$.fragment,e),c(tt.$$.fragment,e),Nl=!0)},o(e){f(j.$$.fragment,e),f(b.$$.fragment,e),f(J.$$.fragment,e),f(A.$$.fragment,e),f(W.$$.fragment,e),f(B.$$.fragment,e),f(v.$$.fragment,e),f(z.$$.fragment,e),f(Q.$$.fragment,e),f(D.$$.fragment,e),f(O.$$.fragment,e),f(K.$$.fragment,e),f(I.$$.fragment,e),f(se.$$.fragment,e),f(oe.$$.fragment,e),f(_.$$.fragment,e),f(pe.$$.fragment,e),f(Me.$$.fragment,e),f(fe.$$.fragment,e),f(we.$$.fragment,e),f(X.$$.fragment,e),f(be.$$.fragment,e),f(Z.$$.fragment,e),f($e.$$.fragment,e),f(Ce.$$.fragment,e),f(k.$$.fragment,e),f(Xe.$$.fragment,e),f(Ze.$$.fragment,e),f(Ge.$$.fragment,e),f(N.$$.fragment,e),f(Be.$$.fragment,e),f(Fe.$$.fragment,e),f(Ye.$$.fragment,e),f(Qe.$$.fragment,e),f(De.$$.fragment,e),f(Ke.$$.fragment,e),f(et.$$.fragment,e),f(tt.$$.fragment,e),Nl=!1},d(e){e&&(l(T),l(w),l(y),l(m),l(x),l(C),l(G),l(ot),l(it),l(V),l(rt),l(pt),l(mt),l(L),l(ut),l(E),l(Mt),l(S),l(dt),l(F),l(ct),l(R),l(ft),l(ht),l(yt),l(Y),l(wt),l(H),l(Tt),l(bt),l(P),l(Jt),l(jt),l(q),l(Ut),l(gt),l($t),l(ee),l(Ct),l(xt),l(te),l(vt),l(le),l(It),l(ne),l(_t),l(Xt),l(ae),l(Zt),l(kt),l(ie),l(Nt),l(Gt),l(re),l(At),l(Vt),l(me),l(Wt),l(ue),l(Bt),l(Lt),l(de),l(Et),l(ce),l(St),l(Ft),l(he),l(Rt),l(ye),l(zt),l(Yt),l(Te),l(Ht),l(Qt),l(Pt),l(Je),l(Dt),l(je),l(qt),l(Ue),l(Ot),l(Kt),l(ge),l(el),l(tl),l(ll),l(xe),l(nl),l(ve),l(sl),l(Ie),l(al),l(ol),l(_e),l(il),l(rl),l(pl),l(ke),l(ml),l(Ne),l(ul),l(Ml),l(dl),l(Ae),l(cl),l(Ve),l(fl),l(We),l(hl),l(yl),l(Le),l(wl),l(Ee),l(Tl),l(Se),l(bl),l(Jl),l(Re),l(jl),l(ze),l(Ul),l(gl),l(He),l($l),l(Cl),l(Pe),l(xl),l(vl),l(qe),l(Il),l(Oe),l(_l),l(Xl),l(Zl),l(kl),l(nt)),l(o),h(j,e),h(b,e),h(J,e),h(A,e),h(W,e),h(B,e),h(v,e),h(z,e),h(Q,e),h(D,e),h(O,e),h(K,e),h(I,e),h(se,e),h(oe,e),h(_,e),h(pe,e),h(Me,e),h(fe,e),h(we,e),h(X,e),h(be,e),h(Z,e),h($e,e),h(Ce,e),h(k,e),h(Xe,e),h(Ze,e),h(Ge,e),h(N,e),h(Be,e),h(Fe,e),h(Ye,e),h(Qe,e),h(De,e),h(Ke,e),h(et,e),h(tt,e)}}}const ts='{"title":"Export a model to Neuron","local":"export-a-model-to-neuron","sections":[{"title":"Summary","local":"summary","sections":[],"depth":2},{"title":"Why compile to Neuron model?","local":"why-compile-to-neuron-model","sections":[],"depth":2},{"title":"Exporting a model to Neuron using the CLI","local":"exporting-a-model-to-neuron-using-the-cli","sections":[{"title":"Exporting standard (non-LLM) models","local":"exporting-standard-non-llm-models","sections":[],"depth":3},{"title":"Exporting Stable Diffusion to Neuron","local":"exporting-stable-diffusion-to-neuron","sections":[],"depth":3},{"title":"Exporting Stable Diffusion XL to Neuron","local":"exporting-stable-diffusion-xl-to-neuron","sections":[],"depth":3},{"title":"Exporting LLMs to Neuron","local":"exporting-llms-to-neuron","sections":[],"depth":3}],"depth":2},{"title":"Exporting neuron models using NeuronX docker images","local":"exporting-neuron-models-using-neuronx-docker-images","sections":[],"depth":2},{"title":"Exporting options and Docker / SageMaker environment variables","local":"exporting-options-and-docker--sagemaker-environment-variables","sections":[{"title":"TGI","local":"tgi","sections":[],"depth":3},{"title":"vLLM","local":"vllm","sections":[],"depth":3}],"depth":2}],"depth":1}';function ls(g){return Ln(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ps extends Sn{constructor(o){super(),Fn(this,o,ls,es,Bn,{})}}export{ps as component};
