Subscribe
Hugging FaceOct 19, 20261 source

Hugging Face libraries now run natively on AWS Trainium through TorchNeuron, covering 89% of top text-generation architectures

TorchNeuron makes Trainium a native PyTorch device with eager mode, torch.compile, FSDP and tensor parallelism, so Transformers, Diffusers, TRL and PEFT run on it directly. Hugging Face now recommends them over Optimum Neuron. The public beta starts October 20.

An aerial view of three Amazon Web Services data center buildings in the us-west-2 region in Oregon, with the Hugging Face and AWS logos

Photo: Tedder / Wikimedia Commons, CC BY-SA 4.0 (Part of AWS's us-west-2 availability zone, 2023). Hugging Face and AWS logos via Wikimedia Commons (public domain).

Hugging Face said on October 19 that its libraries now natively support TorchNeuron, a new PyTorch backend for AWS Trainium, the chip Amazon designed for cost-effective training at scale. TorchNeuron is a PyTorch plugin that brings eager mode, torch.compile and native distributed APIs such as FSDP and tensor parallelism to Trainium. It becomes available as a public beta on October 20, installed with pip install torch-neuronx.

Until now, the Hugging Face experience on Trainium and Inferentia ran through the optimum-neuron library, which relied on PyTorch XLA. That meant "thinking like a compiler," the post says: lazy tensors instead of eager execution, static shapes only and a recompilation for every graph break. With TorchNeuron, "Trainium becomes a device like any other": Transformers, Diffusers, Accelerate, PEFT and TRL run on it with the same classes and scripts used on any other accelerator, and Hugging Face now recommends Neuron users use those libraries directly instead of Optimum Neuron.

For inference, 89% of the 100 most-used text-generation model architectures are supported out of the box, compared with 46% under Optimum Neuron v0.4.5, by passing device_map=neuron. For training, the post shows a standard TRL supervised fine-tuning script running on eight Trainium2 chips (32 NeuronCores, half a trn2.48xlarge instance), producing a standard Transformers checkpoint that can be pushed to the Hub and loaded on any other hardware.

Many Diffusers pipelines also work with TorchNeuron in eager and compiled modes, and FLUX.1-dev, FLUX.2, Qwen-Image, Qwen-Image-2.1 and H3 support tensor parallelism. Hugging Face pointed to Neuron kernels on the Hub, including one it says speeds up vision transformers by up to 2.4x on Trainium, and thanked the AWS team for its work on TorchNeuron.

Sources (1)

  1. Hugging Face Blog — TorchNeuron: running HF models on AWS Trainium is easier than ever, Oct 19, 2026
← Back to AI World News