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