|
Download README.md from ElvanoSaputra12/SetterData: direct link, hf CLI and curl.
- Browser
- Download file 9.13 kB
-
https://huggingface.co/datasets/ElvanoSaputra12/SetterData/resolve/main/README.md
- Command line
-
hf download hf://datasets/ElvanoSaputra12/SetterData/README.md
-
curl -L -o README.md https://huggingface.co/datasets/ElvanoSaputra12/SetterData/resolve/main/README.md
9.13 kB
| license: apache-2.0 | |
| pretty_name: torch-neuronx model support | |
| tags: | |
| - neuron | |
| - trainium | |
| - transformers | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: train | |
| path: data/*/*/*.parquet | |
| # torch-neuronx model support | |
| Which Hugging Face Hub models run unmodified on AWS Trainium, through the | |
| native PyTorch backend | |
| [`torch-neuronx`](https://github.com/aws-neuron/torch-neuronx), for each | |
| `neuronx-cc` and library version tested. The only library tested so far is | |
| [`transformers`](https://github.com/huggingface/transformers). | |
| To look up a model, use the | |
| [Space](https://huggingface.co/spaces/aws-neuron/torch-neuronx-model-support). | |
| ## What is tested | |
| ### transformers | |
| Each run loads a model on a `trn2` instance and generates 32 tokens greedily | |
| from the prompt `"The future of AI is"`, sent as a user message for chat | |
| models. The model is sharded over the smallest power-of-two number of | |
| NeuronCores that fits its bf16 weights, one rank per core: with | |
| `tp_plan="auto"`, or expert-parallel for mixture-of-experts models without a | |
| tensor-parallel plan. Generation uses `torch.compile(backend="neuron")` with a | |
| static cache and chunked prefill. An encoder-decoder model runs its encoder | |
| once on the prompt, then generates from its decoder, on one NeuronCore. | |
| A text encoder, such as a BERT, RoBERTa or DeBERTa model, runs one forward pass | |
| instead, on one NeuronCore, compiled with `torch.compile(backend="neuron")`. Its | |
| input is the sentence `"My name is Wolfgang and I live in Berlin."`, padded to | |
| 128 tokens, with `Berlin` masked for a masked language model, and after the | |
| question `"Where do I live?"` for a question-answering one. It loads with the | |
| head class its checkpoint declares, or without a head. | |
| Speech recognition models and image encoders run on samples of the | |
| transformers tests, on one NeuronCore. A CTC model, such as a wav2vec2 one, | |
| runs one forward pass on the LibriSpeech clip `librispeech_mr_quilter.wav`, | |
| and Whisper transcribes it in English, generating as the encoder-decoder models | |
| do. An image encoder, such as a ViT, CLIP, SigLIP or DINOv2 model, runs one | |
| forward pass on `cats_image.jpeg`, the COCO photo of two cats. A model that | |
| matches images with texts, such as CLIP, scores `"a photo of a cat"` and | |
| `"a photo of a dog"`. | |
| For now, only models that fit on 4 devices of the target are tested, 16 | |
| NeuronCores at most. | |
| | `result` | Meaning | | |
| |---|---| | |
| | `PASS` | The model loaded, `generate()` or an encoder's forward pass returned, and the output check passed or could not run. | | |
| | `FAIL(load)` | `from_pretrained` raised. | | |
| | `FAIL(gen)` | `generate()` raised. | | |
| | `FAIL(forward)` | An encoder's forward pass raised. | | |
| | `FAIL(output)` | `generate()` or the forward pass returned, but the output check failed. | | |
| | `FAIL(other)` | The run crashed, or the model's extra Python packages could not be installed. | | |
| | `EXCLUDED` | Not tested: the sweep's selection left the model out, for the reason in `notes`. A later run of the model replaces this row. | | |
| The output check compares a run on one NeuronCore with a CPU run of the same | |
| checkpoint and prompt: the tokens must match, or differ first at a near-tie. | |
| On more cores, or when the CPU run cannot complete, a small instruct model | |
| judges whether the text is fluent English. `PASS` says nothing about | |
| throughput or about longer generations. | |
| For an encoder, the CPU runs the same forward pass in fp32, the reference, and | |
| in bf16, which shows how far bf16 alone drifts from it: far, for some models. | |
| Neuron, in bf16, is held to what the CPU achieves in bf16. The predictions must | |
| be the CPU's, in fp32 or in bf16, or differ from fp32's only at a near-tie: the | |
| masked word, each token's label, the class, the answer span, the token of each | |
| audio frame or the text that best matches the image. A head with a | |
| single output, such as a reranker's score, must stay within 1.0 of fp32's, or | |
| within twice the bf16 CPU run's distance to it. Without a head, each token's | |
| hidden state must have a cosine similarity of at least 0.99 with fp32's, or a | |
| cosine distance to it at most twice the bf16 CPU run's. | |
| The models are the top `text-generation` and `image-text-to-text` models on | |
| the Hub by downloads and trending, reselected before each sweep: the 100 | |
| best-ranked form the selection. The selection presents the original models: | |
| it leaves out the fine-tunes and repackages of other orgs' models, and keeps | |
| the best-ranked repo of each name. The sweep's list continues with the models of | |
| these tasks, of `translation` and `summarization`, encoder-decoder models | |
| included, of the text encoder tasks (`fill-mask`, `token-classification`, | |
| `text-classification`, `question-answering`, `zero-shot-classification`, | |
| `feature-extraction`, `sentence-similarity` and `text-ranking`), of | |
| `automatic-speech-recognition` and of the image encoder tasks | |
| (`image-classification`, `zero-shot-image-classification` and | |
| `image-feature-extraction`), down to rank | |
| 1000 among the Hub's transformers models of their task, by downloads or | |
| trending, forks and every repo of a name included. Each sweep goes down the | |
| list in order until it has | |
| run 100 models, skipping those whose test script has not changed since their | |
| last run. Quantized checkpoints and models that need `trust_remote_code` are | |
| left out. A model that leaves the list keeps the results it already has. | |
| ## Layout | |
| There is one file per Neuron target (`trn2`, `trn3`) and tested | |
| `(neuronx-cc, library version)` pair: | |
| ``` | |
| data/<target>/neuronxcc-<version>/<library>-<version>.parquet | |
| ``` | |
| Each sweep tests the current Neuron SDK with the library version of the day, | |
| so most pairs are never tested. A model missing from a target's pair was not | |
| tested there, which does not mean it fails. A model the sweep left out has an | |
| `EXCLUDED` row instead, with no `neuron_cores` or `runner`. | |
| | Column | Content | | |
| |---|---| | |
| | `model_id`, `library`, `neuron_cores`, `runner` | The model, the library that loads it, the number of NeuronCores it was sharded over (its tensor- or expert-parallel degree), and the load class (`run_dense`: `AutoModelForCausalLM`, `run_multimodal`: `AutoModelForImageTextToText`, `run_seq2seq`: `AutoModelForSeq2SeqLM`, `run_seq2seq_audio`: `AutoModelForSpeechSeq2Seq`, `run_dense_ep`: expert-parallel, `run_encoder`, `run_encoder_audio` and `run_encoder_image`: the head class the checkpoint declares, `AutoModelForZeroShotImageClassification` for an image model that matches images with texts, or `AutoModel`). | | |
| | `target` | The Neuron target the run compiled for and ran on: `trn2` (Trainium2) or `trn3` (Trainium3). The sweep picks each model's `neuron_cores` from the memory of the target's NeuronCores, so a model can run on fewer cores of one target than of the other. | | |
| | `selection_rank` | The model's rank, from 1, in the selection of the latest sweep of the target's pair, empty if that selection does not hold it. | | |
| | `result`, `notes` | The outcome, and the start of the generated text, of an encoder's prediction or of the error, or why the model was excluded. | | |
| | `exclusion` | The category of the rule that excluded an `EXCLUDED` model, such as `quantized` or `trust-remote-code`. | | |
| | `error` | The full exception message of a `FAIL(load)`, `FAIL(gen)` or `FAIL(forward)` run. | | |
| | `cpu_match` | Runs on one NeuronCore only: `Y` if the tokens, or an encoder's predictions, match a CPU run, `~ near-tie …` if they differ only at a near-tie, `N …` if not. | | |
| | `english` | The judge's verdict, `Y` or `N`, when the CPU comparison did not run. | | |
| | `wall_s`, `hbm_peak_gb`, `hbm_capacity_gb` | Wall time of the whole test, and peak device memory against what its NeuronCores provide. `wall_s` also counts installing the model's extra Python packages and downloading its weights, but compilation only for the graphs that the NEFF cache did not hold yet, so it does not compare across runs. | | |
| | `neuronx_cc`, `library_version`, `transformers`, `accelerate`, `torch_neuronx`, `torch`, `nki`, `python`, `neuron_driver` | The stack the run used. `transformers` is also set for the libraries built on it. | | |
| | `tested_at` | When the run started (UTC). | | |
| | `run_py` | The standalone script that ran. | | |
| ## Querying | |
| ```python | |
| 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"][["target", "neuronx_cc", "library", "library_version", "neuron_cores", "result"]] | |
| ``` | |
| ## Reproducing a run | |
| Each `run_py` is a standalone script. Its header lists the Neuron stack it ran | |
| on and a `pip install` line for the packages it adds on top. On an instance of | |
| its `target` with that stack, for example the AWS Neuron Deep Learning | |
| Container, install those packages, then: | |
| ```bash | |
| python3 run.py | |
| ``` | |
| The run can skip compilation by first copying the compiled graphs of its | |
| target and compiler, from the public | |
| [NEFF cache](https://huggingface.co/buckets/aws-neuron/torch-neuronx-neff-cache): | |
| ```bash | |
| hf buckets sync hf://buckets/aws-neuron/torch-neuronx-neff-cache/<target>/neuronxcc-<neuronx_cc> /tmp/neff_cache | |
| ``` | |
| On more than one NeuronCore, the script launches its own `torch.distributed` | |
| ranks. | |