import{s as Nn,o as An,n as nt,a as Vn}from"../chunks/scheduler.56725da7.js";import{S as Wn,i as Bn,e as i,s,c as M,h as Gn,a as r,d as l,b as a,f as Zn,g as d,j as p,k as lt,l as Ln,m as n,n as c,t as f,o as h,p as w,q as Xn,r as kn}from"../chunks/index.18a26576.js";import{T as et}from"../chunks/Tip.5b941656.js";import{C as En}from"../chunks/CopyLLMTxtMenu.b9295305.js";import{C as U}from"../chunks/CodeBlock.8f86d875.js";import{H as $}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.61bde07c.js";function Sn(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.`,y,u,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,y=s(),u=i("p"),u.innerHTML=J},l(m){o=r(m,"P",{"data-svelte-h":!0}),p(o)!=="svelte-1u9pown"&&(o.textContent=T),y=a(m),u=r(m,"P",{"data-svelte-h":!0}),p(u)!=="svelte-430w7w"&&(u.innerHTML=J)},m(m,b){n(m,o,b),n(m,y,b),n(m,u,b)},p:nt,d(m){m&&(l(o),l(y),l(u))}}}function Yn(g){let o,T,y,u,J="<strong>NEFF</strong>: Neuron Executable File Format which is a binary executable on Neuron devices.";return{c(){o=i("img"),y=s(),u=i("p"),u.innerHTML=J,this.h()},l(m){o=r(m,"IMG",{title:!0,alt:!0,src:!0}),y=a(m),u=r(m,"P",{"data-svelte-h":!0}),p(u)!=="svelte-di565y"&&(u.innerHTML=J),this.h()},h(){lt(o,"title","Compilation flow"),lt(o,"alt","Compilation flow"),Vn(o.src,T="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/optimum/neuron/inf_compile_flow.png")||lt(o,"src",T)},m(m,b){n(m,o,b),n(m,y,b),n(m,u,b)},p:nt,d(m){m&&(l(o),l(y),l(u))}}}function Fn(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>.",y,u,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,y=s(),u=i("p"),u.innerHTML=J,m=s(),M(b.$$.fragment)},l(j){o=r(j,"P",{"data-svelte-h":!0}),p(o)!=="svelte-18qxt3n"&&(o.innerHTML=T),y=a(j),u=r(j,"P",{"data-svelte-h":!0}),p(u)!=="svelte-184kmao"&&(u.innerHTML=J),m=a(j),d(b.$$.fragment,j)},m(j,C){n(j,o,C),n(j,y,C),n(j,u,C),n(j,m,C),c(b,j,C),x=!0},p:nt,i(j){x||(f(b.$$.fragment,j),x=!0)},o(j){h(b.$$.fragment,j),x=!1},d(j){j&&(l(o),l(y),l(u),l(m)),w(b,j)}}}function Rn(g){let o;return{c(){o=Xn(`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=kn(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,y){n(T,o,y)},d(T){T&&l(o)}}}function zn(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.”",y,u,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,y=s(),u=i("p"),u.innerHTML=J},l(m){o=r(m,"P",{"data-svelte-h":!0}),p(o)!=="svelte-9etaml"&&(o.textContent=T),y=a(m),u=r(m,"P",{"data-svelte-h":!0}),p(u)!=="svelte-1dh7n4s"&&(u.innerHTML=J)},m(m,b){n(m,o,b),n(m,y,b),n(m,u,b)},p:nt,d(m){m&&(l(o),l(y),l(u))}}}function Hn(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(y){o=r(y,"P",{"data-svelte-h":!0}),p(o)!=="svelte-r3q4ut"&&(o.textContent=T)},m(y,u){n(y,o,u)},p:nt,d(y){y&&l(o)}}}function Qn(g){let o;return{c(){o=Xn("The export of LLM models can take much longer than standard models (sometimes more than one hour).")},l(T){o=kn(T,"The export of LLM models can take much longer than standard models (sometimes more than one hour).")},m(T,y){n(T,o,y)},d(T){T&&l(o)}}}function Pn(g){let o,T,y,u,J,m,b,x,j,C,A,Zl="Exporting a PyTorch model to Neuron model is as simple as",st,V,at,W,Xl="Check out the help for more options:",ot,B,it,G,rt,L,kl='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>.',pt,E,Nl='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,Al="Although pre-compilation avoids overhead during the inference, a compiled Neuron model has some limitations:",ut,Y,Vl=`<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 trn2 (NeuronCore-v3) 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>`,Mt,F,Wl="In this guide, we’ll show you how to export your models to serialized models optimized for Neuron devices.",dt,I,ct,R,ft,z,Bl="To export a 🤗 Transformers model to Neuron, you’ll first need to install some extra dependencies:",ht,H,Gl="<strong>For Inf2</strong>",wt,Q,yt,P,Ll="The Optimum Neuron export can be used through Optimum command-line:",Tt,D,bt,q,jt,O,El="Most models present on the Hugging Face hub can be straightforwardly exported using torch trace, then converted to serialized and optimized TorchScript modules.",Jt,v,Ut,K,Sl="When exporting a model, two sets of export arguments must be passed:",gt,ee,Yl="<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>",$t,te,Fl="Please type the following command to see all export parameters:",Ct,le,xt,ne,Rl="Exporting a standard NLP model can be done as follows:",It,se,vt,ae,zl=`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.`,_t,_,Zt,oe,Hl="After export, you should see the following logs which validate the model on Neuron devices by comparing with PyTorch model on CPU:",Xt,ie,kt,re,Ql="This exports a neuron-compiled TorchScript module of the checkpoint defined by the <code>--model</code> argument.",Nt,pe,Pl="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:",At,me,Vt,ue,Dl="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.",Wt,Me,ql="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:",Bt,de,Gt,ce,Ol="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.",Lt,fe,Kl="Once exported, the neuron model can be used for inference directly with the <code>NeuronModelForXXX</code> class:",Et,he,St,we,en=`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.`,Yt,Z,Ft,ye,Rt,Te,tn="With the Optimum CLI you can compile components in the Stable Diffusion pipeline to gain acceleration on neuron devices during the inference.",zt,be,ln="So far, we support the export of following components in the pipeline:",Ht,je,nn="<li>CLIP text encoder</li> <li>U-Net</li> <li>VAE encoder</li> <li>VAE decoder</li>",Qt,X,Pt,Je,sn="Exporting a stable diffusion checkpoint can be done using the CLI:",Dt,Ue,qt,ge,Ot,$e,an="Similar to Stable Diffusion, you will be able to use Optimum CLI to compile components in the SDXL pipeline for inference on neuron devices.",Kt,Ce,on="We support the export of following components in the pipeline to boost the speed:",el,xe,rn="<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>",tl,k,ll,Ie,pn="Exporting a SDXL checkpoint can be done using the CLI:",nl,ve,sl,_e,al,Ze,mn="Just like the standard NLP models, you need to specify static parameters when exporting an LLM model:",ol,Xe,un=`<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>`,il,ke,rl,N,pl,Ne,Mn=`As explained before, the neuron model parameters are static.
This means in particular that during inference:`,ml,Ae,dn="<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>",ul,Ve,cn=`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.`,Ml,We,dl,Be,fn='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.',cl,Ge,hn="Please be aware that:",fl,Le,wn=`<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>`,hl,Ee,wl,Se,yn="The NeuronX TGI image includes not only NeuronX runtime, but also all packages and tools required to export Neuron models.",yl,Ye,Tn="Use the following command to export a model to Neuron using a vLLM image:",Tl,Fe,bl,Re,bn="The exported model will be saved under <code>./data/&lt;neuron_model_path&gt;</code>.",jl,ze,Jl,He,jn="You must make sure that the options used for compilation match the options used for deployment.",Ul,Qe,gl,Pe,Jn='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>.',$l,De,Un="For Docker and SageMaker, you can see these reflected in the following options and their optimum-cli equivalent:",Cl,qe,xl,Oe,Il,Ke,vl,tt,_l;return J=new En({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"}}),V=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}}),B=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}}),G=new $({props:{title:"Why compile to Neuron model?",local:"why-compile-to-neuron-model",headingTag:"h2"}}),I=new et({props:{$$slots:{default:[Sn]},$$scope:{ctx:g}}}),R=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:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtLWhlbHA=",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron --<span class="hljs-built_in">help</span>',wrap:!1}}),q=new $({props:{title:"Exporting standard (non-LLM) models",local:"exporting-standard-non-llm-models",headingTag:"h3"}}),v=new et({props:{$$slots:{default:[Yn]},$$scope:{ctx:g}}}),le=new U({props:{code:"b3B0aW11bS1jbGklMjBleHBvcnQlMjBuZXVyb24lMjAtaA==",highlighted:'optimum-cli <span class="hljs-built_in">export</span> neuron -h',wrap:!1}}),se=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 et({props:{$$slots:{default:[Fn]},$$scope:{ctx:g}}}),ie=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}}),de=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}}),he=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}}),Z=new et({props:{$$slots:{default:[Rn]},$$scope:{ctx:g}}}),ye=new $({props:{title:"Exporting Stable Diffusion to Neuron",local:"exporting-stable-diffusion-to-neuron",headingTag:"h3"}}),X=new et({props:{$$slots:{default:[zn]},$$scope:{ctx:g}}}),Ue=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}}),ge=new $({props:{title:"Exporting Stable Diffusion XL to Neuron",local:"exporting-stable-diffusion-xl-to-neuron",headingTag:"h3"}}),k=new et({props:{$$slots:{default:[Hn]},$$scope:{ctx:g}}}),ve=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}}),_e=new $({props:{title:"Exporting LLMs to Neuron",local:"exporting-llms-to-neuron",headingTag:"h3"}}),ke=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 et({props:{$$slots:{default:[Qn]},$$scope:{ctx:g}}}),We=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}}),Ee=new $({props:{title:"Exporting neuron models using NeuronX docker images",local:"exporting-neuron-models-using-neuronx-docker-images",headingTag:"h2"}}),Fe=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}}),ze=new $({props:{title:"Exporting options and Docker / SageMaker environment variables",local:"exporting-options-and-docker--sagemaker-environment-variables",headingTag:"h2"}}),Qe=new $({props:{title:"TGI",local:"tgi",headingTag:"h3"}}),qe=new U({props:{code:"TU9ERUxfSUQlMjAlM0QlMjBtb2RlbCUwQU1BWF9CQVRDSF9TSVpFJTIwJTNEJTIwYmF0Y2hfc2l6ZSUwQU1BWF9UT1RBTF9UT0tFTlMlMjAlM0QlMjBzZXF1ZW5jZV9sZW5ndGglMEFIRl9OVU1fQ09SRVMlMjAlM0QlMjB0ZW5zb3JfcGFyYWxsZWxfc2l6ZQ==",highlighted:`<span class="hljs-attr">MODEL_ID</span> = model
<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}}),Oe=new $({props:{title:"vLLM",local:"vllm",headingTag:"h3"}}),Ke=new U({props:{code:"U01fT05fTU9ERUwlMjAlM0QlMjBtb2RlbCUwQVNNX09OX0JBVENIX1NJWkUlMjAlM0QlMjBiYXRjaF9zaXplJTBBU01fT05fU0VRVUVOQ0VfTEVOR1RIJTIwJTNEJTIwc2VxdWVuY2VfbGVuZ3RoJTBBU01fT05fVEVOU09SX1BBUkFMTEVMX1NJWkUlMjAlM0QlMjB0ZW5zb3JfcGFyYWxsZWxfc2l6ZQ==",highlighted:`<span class="hljs-attr">SM_ON_MODEL</span> = model
<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(),y=i("p"),u=s(),M(J.$$.fragment),m=s(),M(b.$$.fragment),x=s(),M(j.$$.fragment),C=s(),A=i("p"),A.textContent=Zl,st=s(),M(V.$$.fragment),at=s(),W=i("p"),W.textContent=Xl,ot=s(),M(B.$$.fragment),it=s(),M(G.$$.fragment),rt=s(),L=i("p"),L.innerHTML=kl,pt=s(),E=i("p"),E.innerHTML=Nl,mt=s(),S=i("p"),S.textContent=Al,ut=s(),Y=i("ul"),Y.innerHTML=Vl,Mt=s(),F=i("p"),F.textContent=Wl,dt=s(),M(I.$$.fragment),ct=s(),M(R.$$.fragment),ft=s(),z=i("p"),z.textContent=Bl,ht=s(),H=i("p"),H.innerHTML=Gl,wt=s(),M(Q.$$.fragment),yt=s(),P=i("p"),P.textContent=Ll,Tt=s(),M(D.$$.fragment),bt=s(),M(q.$$.fragment),jt=s(),O=i("p"),O.textContent=El,Jt=s(),M(v.$$.fragment),Ut=s(),K=i("p"),K.textContent=Sl,gt=s(),ee=i("ul"),ee.innerHTML=Yl,$t=s(),te=i("p"),te.textContent=Fl,Ct=s(),M(le.$$.fragment),xt=s(),ne=i("p"),ne.textContent=Rl,It=s(),M(se.$$.fragment),vt=s(),ae=i("p"),ae.innerHTML=zl,_t=s(),M(_.$$.fragment),Zt=s(),oe=i("p"),oe.textContent=Hl,Xt=s(),M(ie.$$.fragment),kt=s(),re=i("p"),re.innerHTML=Ql,Nt=s(),pe=i("p"),pe.innerHTML=Pl,At=s(),M(me.$$.fragment),Vt=s(),ue=i("p"),ue.innerHTML=Dl,Wt=s(),Me=i("p"),Me.innerHTML=ql,Bt=s(),M(de.$$.fragment),Gt=s(),ce=i("p"),ce.innerHTML=Ol,Lt=s(),fe=i("p"),fe.innerHTML=Kl,Et=s(),M(he.$$.fragment),St=s(),we=i("p"),we.innerHTML=en,Yt=s(),M(Z.$$.fragment),Ft=s(),M(ye.$$.fragment),Rt=s(),Te=i("p"),Te.textContent=tn,zt=s(),be=i("p"),be.textContent=ln,Ht=s(),je=i("ul"),je.innerHTML=nn,Qt=s(),M(X.$$.fragment),Pt=s(),Je=i("p"),Je.textContent=sn,Dt=s(),M(Ue.$$.fragment),qt=s(),M(ge.$$.fragment),Ot=s(),$e=i("p"),$e.textContent=an,Kt=s(),Ce=i("p"),Ce.textContent=on,el=s(),xe=i("ul"),xe.innerHTML=rn,tl=s(),M(k.$$.fragment),ll=s(),Ie=i("p"),Ie.textContent=pn,nl=s(),M(ve.$$.fragment),sl=s(),M(_e.$$.fragment),al=s(),Ze=i("p"),Ze.textContent=mn,ol=s(),Xe=i("ul"),Xe.innerHTML=un,il=s(),M(ke.$$.fragment),rl=s(),M(N.$$.fragment),pl=s(),Ne=i("p"),Ne.textContent=Mn,ml=s(),Ae=i("ul"),Ae.innerHTML=dn,ul=s(),Ve=i("p"),Ve.innerHTML=cn,Ml=s(),M(We.$$.fragment),dl=s(),Be=i("p"),Be.innerHTML=fn,cl=s(),Ge=i("p"),Ge.textContent=hn,fl=s(),Le=i("ul"),Le.innerHTML=wn,hl=s(),M(Ee.$$.fragment),wl=s(),Se=i("p"),Se.textContent=yn,yl=s(),Ye=i("p"),Ye.textContent=Tn,Tl=s(),M(Fe.$$.fragment),bl=s(),Re=i("p"),Re.innerHTML=bn,jl=s(),M(ze.$$.fragment),Jl=s(),He=i("p"),He.textContent=jn,Ul=s(),M(Qe.$$.fragment),gl=s(),Pe=i("p"),Pe.innerHTML=Jn,$l=s(),De=i("p"),De.textContent=Un,Cl=s(),M(qe.$$.fragment),xl=s(),M(Oe.$$.fragment),Il=s(),M(Ke.$$.fragment),vl=s(),tt=i("p"),this.h()},l(e){const t=Gn("svelte-u9bgzb",document.head);o=r(t,"META",{name:!0,content:!0}),t.forEach(l),T=a(e),y=r(e,"P",{}),Zn(y).forEach(l),u=a(e),d(J.$$.fragment,e),m=a(e),d(b.$$.fragment,e),x=a(e),d(j.$$.fragment,e),C=a(e),A=r(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-166ewzk"&&(A.textContent=Zl),st=a(e),d(V.$$.fragment,e),at=a(e),W=r(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-b35baa"&&(W.textContent=Xl),ot=a(e),d(B.$$.fragment,e),it=a(e),d(G.$$.fragment,e),rt=a(e),L=r(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-1esvin7"&&(L.innerHTML=kl),pt=a(e),E=r(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1und41a"&&(E.innerHTML=Nl),mt=a(e),S=r(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-2ri5fz"&&(S.textContent=Al),ut=a(e),Y=r(e,"UL",{"data-svelte-h":!0}),p(Y)!=="svelte-9ojx5"&&(Y.innerHTML=Vl),Mt=a(e),F=r(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-189k6c5"&&(F.textContent=Wl),dt=a(e),d(I.$$.fragment,e),ct=a(e),d(R.$$.fragment,e),ft=a(e),z=r(e,"P",{"data-svelte-h":!0}),p(z)!=="svelte-jz73et"&&(z.textContent=Bl),ht=a(e),H=r(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1qm5x97"&&(H.innerHTML=Gl),wt=a(e),d(Q.$$.fragment,e),yt=a(e),P=r(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-cb2pjp"&&(P.textContent=Ll),Tt=a(e),d(D.$$.fragment,e),bt=a(e),d(q.$$.fragment,e),jt=a(e),O=r(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-p91rke"&&(O.textContent=El),Jt=a(e),d(v.$$.fragment,e),Ut=a(e),K=r(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-9ahyv2"&&(K.textContent=Sl),gt=a(e),ee=r(e,"UL",{"data-svelte-h":!0}),p(ee)!=="svelte-uw9cro"&&(ee.innerHTML=Yl),$t=a(e),te=r(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1ldr9ls"&&(te.textContent=Fl),Ct=a(e),d(le.$$.fragment,e),xt=a(e),ne=r(e,"P",{"data-svelte-h":!0}),p(ne)!=="svelte-eag7fc"&&(ne.textContent=Rl),It=a(e),d(se.$$.fragment,e),vt=a(e),ae=r(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-1k4xv5r"&&(ae.innerHTML=zl),_t=a(e),d(_.$$.fragment,e),Zt=a(e),oe=r(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-9jbb9y"&&(oe.textContent=Hl),Xt=a(e),d(ie.$$.fragment,e),kt=a(e),re=r(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-v1u856"&&(re.innerHTML=Ql),Nt=a(e),pe=r(e,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-vql48n"&&(pe.innerHTML=Pl),At=a(e),d(me.$$.fragment,e),Vt=a(e),ue=r(e,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-1hgclei"&&(ue.innerHTML=Dl),Wt=a(e),Me=r(e,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-yhg472"&&(Me.innerHTML=ql),Bt=a(e),d(de.$$.fragment,e),Gt=a(e),ce=r(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-1ab1ldn"&&(ce.innerHTML=Ol),Lt=a(e),fe=r(e,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-3rh7j4"&&(fe.innerHTML=Kl),Et=a(e),d(he.$$.fragment,e),St=a(e),we=r(e,"P",{"data-svelte-h":!0}),p(we)!=="svelte-1ugid4e"&&(we.innerHTML=en),Yt=a(e),d(Z.$$.fragment,e),Ft=a(e),d(ye.$$.fragment,e),Rt=a(e),Te=r(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-vfmt4g"&&(Te.textContent=tn),zt=a(e),be=r(e,"P",{"data-svelte-h":!0}),p(be)!=="svelte-1lozjup"&&(be.textContent=ln),Ht=a(e),je=r(e,"UL",{"data-svelte-h":!0}),p(je)!=="svelte-1bxicg6"&&(je.innerHTML=nn),Qt=a(e),d(X.$$.fragment,e),Pt=a(e),Je=r(e,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-1s0jvqd"&&(Je.textContent=sn),Dt=a(e),d(Ue.$$.fragment,e),qt=a(e),d(ge.$$.fragment,e),Ot=a(e),$e=r(e,"P",{"data-svelte-h":!0}),p($e)!=="svelte-12l5vu1"&&($e.textContent=an),Kt=a(e),Ce=r(e,"P",{"data-svelte-h":!0}),p(Ce)!=="svelte-1cwhii6"&&(Ce.textContent=on),el=a(e),xe=r(e,"UL",{"data-svelte-h":!0}),p(xe)!=="svelte-17e9k9s"&&(xe.innerHTML=rn),tl=a(e),d(k.$$.fragment,e),ll=a(e),Ie=r(e,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-112a1oc"&&(Ie.textContent=pn),nl=a(e),d(ve.$$.fragment,e),sl=a(e),d(_e.$$.fragment,e),al=a(e),Ze=r(e,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-1fq0lez"&&(Ze.textContent=mn),ol=a(e),Xe=r(e,"UL",{"data-svelte-h":!0}),p(Xe)!=="svelte-1tmw6po"&&(Xe.innerHTML=un),il=a(e),d(ke.$$.fragment,e),rl=a(e),d(N.$$.fragment,e),pl=a(e),Ne=r(e,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-1jrgmyt"&&(Ne.textContent=Mn),ml=a(e),Ae=r(e,"UL",{"data-svelte-h":!0}),p(Ae)!=="svelte-1y4z1sb"&&(Ae.innerHTML=dn),ul=a(e),Ve=r(e,"P",{"data-svelte-h":!0}),p(Ve)!=="svelte-154my7d"&&(Ve.innerHTML=cn),Ml=a(e),d(We.$$.fragment,e),dl=a(e),Be=r(e,"P",{"data-svelte-h":!0}),p(Be)!=="svelte-1266wn0"&&(Be.innerHTML=fn),cl=a(e),Ge=r(e,"P",{"data-svelte-h":!0}),p(Ge)!=="svelte-1g2jw6w"&&(Ge.textContent=hn),fl=a(e),Le=r(e,"UL",{"data-svelte-h":!0}),p(Le)!=="svelte-14ajc9a"&&(Le.innerHTML=wn),hl=a(e),d(Ee.$$.fragment,e),wl=a(e),Se=r(e,"P",{"data-svelte-h":!0}),p(Se)!=="svelte-1pkpov5"&&(Se.textContent=yn),yl=a(e),Ye=r(e,"P",{"data-svelte-h":!0}),p(Ye)!=="svelte-imsem4"&&(Ye.textContent=Tn),Tl=a(e),d(Fe.$$.fragment,e),bl=a(e),Re=r(e,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-ezhare"&&(Re.innerHTML=bn),jl=a(e),d(ze.$$.fragment,e),Jl=a(e),He=r(e,"P",{"data-svelte-h":!0}),p(He)!=="svelte-11sp8vf"&&(He.textContent=jn),Ul=a(e),d(Qe.$$.fragment,e),gl=a(e),Pe=r(e,"P",{"data-svelte-h":!0}),p(Pe)!=="svelte-10bd5lk"&&(Pe.innerHTML=Jn),$l=a(e),De=r(e,"P",{"data-svelte-h":!0}),p(De)!=="svelte-xq57dd"&&(De.textContent=Un),Cl=a(e),d(qe.$$.fragment,e),xl=a(e),d(Oe.$$.fragment,e),Il=a(e),d(Ke.$$.fragment,e),vl=a(e),tt=r(e,"P",{}),Zn(tt).forEach(l),this.h()},h(){lt(o,"name","hf:doc:metadata"),lt(o,"content",Dn)},m(e,t){Ln(document.head,o),n(e,T,t),n(e,y,t),n(e,u,t),c(J,e,t),n(e,m,t),c(b,e,t),n(e,x,t),c(j,e,t),n(e,C,t),n(e,A,t),n(e,st,t),c(V,e,t),n(e,at,t),n(e,W,t),n(e,ot,t),c(B,e,t),n(e,it,t),c(G,e,t),n(e,rt,t),n(e,L,t),n(e,pt,t),n(e,E,t),n(e,mt,t),n(e,S,t),n(e,ut,t),n(e,Y,t),n(e,Mt,t),n(e,F,t),n(e,dt,t),c(I,e,t),n(e,ct,t),c(R,e,t),n(e,ft,t),n(e,z,t),n(e,ht,t),n(e,H,t),n(e,wt,t),c(Q,e,t),n(e,yt,t),n(e,P,t),n(e,Tt,t),c(D,e,t),n(e,bt,t),c(q,e,t),n(e,jt,t),n(e,O,t),n(e,Jt,t),c(v,e,t),n(e,Ut,t),n(e,K,t),n(e,gt,t),n(e,ee,t),n(e,$t,t),n(e,te,t),n(e,Ct,t),c(le,e,t),n(e,xt,t),n(e,ne,t),n(e,It,t),c(se,e,t),n(e,vt,t),n(e,ae,t),n(e,_t,t),c(_,e,t),n(e,Zt,t),n(e,oe,t),n(e,Xt,t),c(ie,e,t),n(e,kt,t),n(e,re,t),n(e,Nt,t),n(e,pe,t),n(e,At,t),c(me,e,t),n(e,Vt,t),n(e,ue,t),n(e,Wt,t),n(e,Me,t),n(e,Bt,t),c(de,e,t),n(e,Gt,t),n(e,ce,t),n(e,Lt,t),n(e,fe,t),n(e,Et,t),c(he,e,t),n(e,St,t),n(e,we,t),n(e,Yt,t),c(Z,e,t),n(e,Ft,t),c(ye,e,t),n(e,Rt,t),n(e,Te,t),n(e,zt,t),n(e,be,t),n(e,Ht,t),n(e,je,t),n(e,Qt,t),c(X,e,t),n(e,Pt,t),n(e,Je,t),n(e,Dt,t),c(Ue,e,t),n(e,qt,t),c(ge,e,t),n(e,Ot,t),n(e,$e,t),n(e,Kt,t),n(e,Ce,t),n(e,el,t),n(e,xe,t),n(e,tl,t),c(k,e,t),n(e,ll,t),n(e,Ie,t),n(e,nl,t),c(ve,e,t),n(e,sl,t),c(_e,e,t),n(e,al,t),n(e,Ze,t),n(e,ol,t),n(e,Xe,t),n(e,il,t),c(ke,e,t),n(e,rl,t),c(N,e,t),n(e,pl,t),n(e,Ne,t),n(e,ml,t),n(e,Ae,t),n(e,ul,t),n(e,Ve,t),n(e,Ml,t),c(We,e,t),n(e,dl,t),n(e,Be,t),n(e,cl,t),n(e,Ge,t),n(e,fl,t),n(e,Le,t),n(e,hl,t),c(Ee,e,t),n(e,wl,t),n(e,Se,t),n(e,yl,t),n(e,Ye,t),n(e,Tl,t),c(Fe,e,t),n(e,bl,t),n(e,Re,t),n(e,jl,t),c(ze,e,t),n(e,Jl,t),n(e,He,t),n(e,Ul,t),c(Qe,e,t),n(e,gl,t),n(e,Pe,t),n(e,$l,t),n(e,De,t),n(e,Cl,t),c(qe,e,t),n(e,xl,t),c(Oe,e,t),n(e,Il,t),c(Ke,e,t),n(e,vl,t),n(e,tt,t),_l=!0},p(e,[t]){const gn={};t&2&&(gn.$$scope={dirty:t,ctx:e}),I.$set(gn);const $n={};t&2&&($n.$$scope={dirty:t,ctx:e}),v.$set($n);const Cn={};t&2&&(Cn.$$scope={dirty:t,ctx:e}),_.$set(Cn);const xn={};t&2&&(xn.$$scope={dirty:t,ctx:e}),Z.$set(xn);const In={};t&2&&(In.$$scope={dirty:t,ctx:e}),X.$set(In);const vn={};t&2&&(vn.$$scope={dirty:t,ctx:e}),k.$set(vn);const _n={};t&2&&(_n.$$scope={dirty:t,ctx:e}),N.$set(_n)},i(e){_l||(f(J.$$.fragment,e),f(b.$$.fragment,e),f(j.$$.fragment,e),f(V.$$.fragment,e),f(B.$$.fragment,e),f(G.$$.fragment,e),f(I.$$.fragment,e),f(R.$$.fragment,e),f(Q.$$.fragment,e),f(D.$$.fragment,e),f(q.$$.fragment,e),f(v.$$.fragment,e),f(le.$$.fragment,e),f(se.$$.fragment,e),f(_.$$.fragment,e),f(ie.$$.fragment,e),f(me.$$.fragment,e),f(de.$$.fragment,e),f(he.$$.fragment,e),f(Z.$$.fragment,e),f(ye.$$.fragment,e),f(X.$$.fragment,e),f(Ue.$$.fragment,e),f(ge.$$.fragment,e),f(k.$$.fragment,e),f(ve.$$.fragment,e),f(_e.$$.fragment,e),f(ke.$$.fragment,e),f(N.$$.fragment,e),f(We.$$.fragment,e),f(Ee.$$.fragment,e),f(Fe.$$.fragment,e),f(ze.$$.fragment,e),f(Qe.$$.fragment,e),f(qe.$$.fragment,e),f(Oe.$$.fragment,e),f(Ke.$$.fragment,e),_l=!0)},o(e){h(J.$$.fragment,e),h(b.$$.fragment,e),h(j.$$.fragment,e),h(V.$$.fragment,e),h(B.$$.fragment,e),h(G.$$.fragment,e),h(I.$$.fragment,e),h(R.$$.fragment,e),h(Q.$$.fragment,e),h(D.$$.fragment,e),h(q.$$.fragment,e),h(v.$$.fragment,e),h(le.$$.fragment,e),h(se.$$.fragment,e),h(_.$$.fragment,e),h(ie.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(he.$$.fragment,e),h(Z.$$.fragment,e),h(ye.$$.fragment,e),h(X.$$.fragment,e),h(Ue.$$.fragment,e),h(ge.$$.fragment,e),h(k.$$.fragment,e),h(ve.$$.fragment,e),h(_e.$$.fragment,e),h(ke.$$.fragment,e),h(N.$$.fragment,e),h(We.$$.fragment,e),h(Ee.$$.fragment,e),h(Fe.$$.fragment,e),h(ze.$$.fragment,e),h(Qe.$$.fragment,e),h(qe.$$.fragment,e),h(Oe.$$.fragment,e),h(Ke.$$.fragment,e),_l=!1},d(e){e&&(l(T),l(y),l(u),l(m),l(x),l(C),l(A),l(st),l(at),l(W),l(ot),l(it),l(rt),l(L),l(pt),l(E),l(mt),l(S),l(ut),l(Y),l(Mt),l(F),l(dt),l(ct),l(ft),l(z),l(ht),l(H),l(wt),l(yt),l(P),l(Tt),l(bt),l(jt),l(O),l(Jt),l(Ut),l(K),l(gt),l(ee),l($t),l(te),l(Ct),l(xt),l(ne),l(It),l(vt),l(ae),l(_t),l(Zt),l(oe),l(Xt),l(kt),l(re),l(Nt),l(pe),l(At),l(Vt),l(ue),l(Wt),l(Me),l(Bt),l(Gt),l(ce),l(Lt),l(fe),l(Et),l(St),l(we),l(Yt),l(Ft),l(Rt),l(Te),l(zt),l(be),l(Ht),l(je),l(Qt),l(Pt),l(Je),l(Dt),l(qt),l(Ot),l($e),l(Kt),l(Ce),l(el),l(xe),l(tl),l(ll),l(Ie),l(nl),l(sl),l(al),l(Ze),l(ol),l(Xe),l(il),l(rl),l(pl),l(Ne),l(ml),l(Ae),l(ul),l(Ve),l(Ml),l(dl),l(Be),l(cl),l(Ge),l(fl),l(Le),l(hl),l(wl),l(Se),l(yl),l(Ye),l(Tl),l(bl),l(Re),l(jl),l(Jl),l(He),l(Ul),l(gl),l(Pe),l($l),l(De),l(Cl),l(xl),l(Il),l(vl),l(tt)),l(o),w(J,e),w(b,e),w(j,e),w(V,e),w(B,e),w(G,e),w(I,e),w(R,e),w(Q,e),w(D,e),w(q,e),w(v,e),w(le,e),w(se,e),w(_,e),w(ie,e),w(me,e),w(de,e),w(he,e),w(Z,e),w(ye,e),w(X,e),w(Ue,e),w(ge,e),w(k,e),w(ve,e),w(_e,e),w(ke,e),w(N,e),w(We,e),w(Ee,e),w(Fe,e),w(ze,e),w(Qe,e),w(qe,e),w(Oe,e),w(Ke,e)}}}const Dn='{"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 qn(g){return An(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ss extends Wn{constructor(o){super(),Bn(this,o,qn,Pn,Nn,{})}}export{ss as component};
