ابزار جدید هاگفیس برای بررسی سازگاری مدلها با سختافزار AWS Trainium

پلتفرم هاگفیس با معرفی یک فضای اختصاصی امکان بررسی اجرای مدلهای مختلف روی تراشههای AWS Trainium را فراهم کرده است. این ابزار به توسعهدهندگان نشان میدهد کدام مدلها بدون نیاز به تغییر روی این سختافزار اجرا میشوند.
هاگفیس با انتشار یک فضای جدید در پلتفرم خود، ابزاری را ارائه کرده است که به کاربران اجازه میدهد وضعیت اجرای مدلهای محبوب یادگیری ماشین را روی سختافزار AWS Trainium بررسی کنند. پیش از این، پشتیبانی از این تراشهها از طریق کتابخانه torch-neuronx فراهم شده بود تا کدهای مدلهای Transformers بتوانند روی این سختافزار نیز اجرا شوند، اما مشخص نبود که کدامیک از مدلهای موجود روی هاب به طور کامل با آن سازگار هستند.
فضای جدید ایجاد شده به کاربران امکان میدهد تا مدلهای محبوب را بر اساس میزان دانلود و روندهای روز جستجو کرده و نتیجه اجرای آنها روی Trainium را مشاهده کنند. هر ردیف از این دادهها اطلاعاتی نظیر تعداد هستههای Trainium استفاده شده، زمان اجرای کل شامل مرحله کامپایل و میزان حافظه مصرفی دستگاه را نمایش میدهد. همچنین این ابزار اسکریپتهای لازم برای اجرای مدلها را در اختیار توسعهدهندگان قرار میدهد تا بتوانند آنها را به طور مستقیم روی نمونههای Trainium2 اجرا کنند.
این نتایج از یک مجموعه داده عمومی استخراج شدهاند و هدف آن تسهیل کار توسعهدهندگانی است که از زیرساختهای آمازون استفاده میکنند. در حال حاضر این بررسیها روی مدلهای تولید متن و تبدیل تصویر به متن تمرکز دارد، اما توسعهدهندگان برنامه هایی برای گسترش آن به حوزههای دیگر نیز دارند.
Does Your Model Run on AWS Trainium? Look It Up
Does Your Model Run on AWS Trainium? Look It Up
In a previous post, we introduced TorchNeuron, the native PyTorch backend for AWS Trainium (the torch-neuronx package). 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?
The torch-neuronx model support Space 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.
Look up a model
The Space opens on the Selected view: 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 the Trending or Downloads view 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-generation and image-text-to-text models. We plan to expand to diffusers, sentence transformers, and other transformers tasks.
Run 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 the run.py script that ran. The script follows the recipe of the TorchNeuron announcement: it loads the model with from_pretrained, sharded when it needs to be, then generates with a static cache and torch.compile(backend="neuron").
On a Trainium2 (trn2) instance with that stack, for example in the AWS Neuron Deep Learning Container, install the packages, then run:
python3 run.py
No need for torchrun: the script launches its own torch.distributed ranks 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 public NEFF cache bucket. 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
What "runs" means
Each test loads the model on a trn2 instance, 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. A PASS says nothing about throughput, or about longer generations.
The results are a dataset
Everything the Space shows comes from the public aws-neuron/torch-neuronx-model-support dataset, with one Parquet file per pair of neuronx-cc and library versions.
Each row holds a model's result, the error when it failed, the versions of the whole stack and the run.py that 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"]]
The dataset card gives the exact meaning of each result.
Next time you wonder whether a model runs on Trainium, look it up.
Source report: Hugging Face Blog.
گزارش فارسی این خبر با کمک هوش مصنوعی و فقط بر اساس اطلاعات منتشرشده در منبع تهیه شده است.