Does Your Model Run on AWS Trainium? Look It Up
Summary
Hugging Face 发布了一个 torch-neuronx 模型支持查询 Space,可查看哪些 Hub 上的模型能在 AWS Trainium 上直接运行,并提供可复现的运行脚本和 NEFF 缓存以跳过编译。目前仅覆盖 text-generation 与 image-text-to-text 类 Transformers 模型,未来将扩展到 diffusers 和 sentence transformers。
View Cached Full Text
Cached at: 10/28/26, 01:30 AM
Does Your Model Run on AWS Trainium? Look It Up
Source: https://huggingface.co/blog/torch-neuronx-model-support
In aprevious post, we introduced TorchNeuron, the native PyTorch backend for AWS Trainium (thetorch\-neuronxpackage). With it, Transformers runs its own modeling code on Trainium, as it does on any other device, so any Transformers model on the Hub may run. Which ones actually do?
Thetorch-neuronx model supportSpace answers that question for the most popular models on the Hub. It tells you whether a model runs unmodified on Trainium, and gives you the script to run it yourself.
https://huggingface.co/blog/torch-neuronx-model-support#look-up-a-modelLook up a model
The Space opens on theSelectedview: our own selection of models picked among the top models on the Hub by downloads and by trending score. Each row gives the result, the number of Trainium cores the model is sharded over, the wall time of the run (compilation included) and the peak device memory.
To look up a given model, switch to theTrendingorDownloadsview and type part of its name. These views follow the Hub’s own rankings, one task at a time, whether a model was tested or not. When a model was left out on purpose, the Space tells you why (most of the time it was not prioritized, sometimes it is truly incompatible). You can also pick the versions of the Neuron compiler (neuronx\-cc) and of Transformers to look at.
At the time of writing, only Transformers models are tested, and our selection is limited to
text\-generationandimage\-text\-to\-textmodels. We plan to expand to diffusers, sentence transformers, and other transformers tasks.
https://huggingface.co/blog/torch-neuronx-model-support#run-it-yourselfRun it yourself
Select a model to see how to run it. The Space lists the Neuron stack the model was tested on, the packages to install on top of it, and therun\.pyscript that ran. The script follows the recipe of theTorchNeuron announcement: it loads the model withfrom\_pretrained, sharded when it needs to be, then generates with a static cache andtorch\.compile\(backend="neuron"\).
On a Trainium2 (trn2) instance with that stack, for example in theAWS Neuron Deep Learning Container, install the packages, then run:
python3 run.py
No need fortorchrun: the script launches its owntorch\.distributedranks when the model is sharded.
A first run starts by compiling the model’s graphs. To skip that step, copy the graphs the same compiler built during the test, from the publicNEFF cachebucket. The Space gives you the command, with the right compiler version:
hf buckets sync hf://buckets/aws-neuron/torch-neuronx-neff-cache/neuronxcc-<version> /tmp/neff_cache
https://huggingface.co/blog/torch-neuronx-model-support#what-runs-meansWhat “runs” means
Each test loads the model on atrn2instance, sharded over the smallest number of Trainium cores that can hold its weights. Most models are sharded with tensor parallelism. Mixture-of-experts models without a tensor-parallel plan use expert parallelism only. The test then generates 32 tokens and checks them. On a single core, the tokens are compared with those of a CPU run of the same checkpoint. When the model is sharded, a small judge model checks that the text is fluent English.
At the time of writing, only models that fit on 4 Trainium2 devices are tested, which means 16 cores at most. APASSsays nothing about throughput, or about longer generations.
https://huggingface.co/blog/torch-neuronx-model-support#the-results-are-a-datasetThe results are a dataset
Everything the Space shows comes from the publicaws\-neuron/torch\-neuronx\-model\-supportdataset, with one Parquet file per pair ofneuronx\-ccand library versions.
Each row holds a model’s result, the error when it failed, the versions of the whole stack and therun\.pythat ran. You can query it directly:
import pandas as pd
df = pd.read_parquet("hf://datasets/aws-neuron/torch-neuronx-model-support/data")
df[df.model_id == "Qwen/Qwen3-0.6B"][["neuronx_cc", "library", "library_version", "neuron_cores", "result"]]
Thedataset cardgives the exact meaning of each result.
Next time you wonder whether a model runs on Trainium,look it up.
Similar Articles
TorchNeuron: running HF models on AWS Trainium is easier than ever
TorchNeuron 作为 PyTorch 的原生 Trainium 后端发布公测,Hugging Face 的 Transformers、Diffusers 等库可直接将其作为普通设备使用,显著提升了模型支持率并取代 Optimum Neuron 的复杂封装。
Introducing TorchNeuron: Native PyTorch backend for AWS Trainium (27 minute read)
AWS 与 PyTorch 宣布推出 TorchNeuron——一个面向 AWS Trainium 芯片的原生 PyTorch 开源后端,支持 eager 执行、torch.compile 与 NKI 自定义内核,模型代码只需 `.to('neuron')` 即可运行,将于 10 月 20 日以 Apache 2.0 公开 Beta。
huggingface/transformers
The Hugging Face Transformers repository, an open-source library providing thousands of pretrained transformer models for natural language processing tasks, with support for PyTorch, TensorFlow, and JAX.
@ajassy: Trying a new AI chip used to be a lot of work. You often had to rewrite your code, revalidate it, and sink many weeks i…
Amazon 发布 TorchNeuron,让现有 PyTorch 代码无需重写即可原生运行在 AWS Trainium 芯片上,并将于 10 月 20 日 PyTorch Conference 上开源。该工具旨在降低开发者切换 AI 硬件的成本,已有多家企业在机器人、自动驾驶、大模型等领域采用。
@nini_incrypto_: Hugging Face automates entire AI training pipeline! Recently, a project called ml-intern has gone viral on GitHub. It's like a 24/7 algorithmic intern that can independently perform post-training of large models. 1. Autonomous research: It will…
The ml-intern project from Hugging Face has gone viral on GitHub, enabling full automation of the entire workflow including paper research, data processing, training script writing, and model training, without human intervention. It significantly improves the performance of small models (such as Qwen3-1.7B), even surpassing Claude Code.