Hugging Face models now run natively on AWS Trainium through TorchNeuron

A new PyTorch backend lets Hugging Face’s main libraries run directly on Amazon’s Trainium chips, without the separate Optimum Neuron layer developers needed before.

1 min read

Hugging Face

At a glance

of top text-generation architectures supported
89%
supported before, with Optimum Neuron
46%
top speedup from a vision transformer kernel
2.4x
What’s new
TorchNeuron, a PyTorch plugin, makes Trainium a standard PyTorch device with eager mode, torch.compile and native distributed training. It is available as a public beta from 20 October.
Who it affects
Developers and AI teams training or serving models on AWS, especially those using Hugging Face libraries.

Until now, Hugging Face support for Trainium came through Optimum Neuron, built on PyTorch XLA. That meant lazy execution, fixed input shapes and a recompile at every graph break, with custom model and trainer code to hide it. Now Transformers, Diffusers, Accelerate, PEFT and TRL run on Trainium with the same scripts used on other accelerators, and Hugging Face recommends using them directly. Fine-tuned models save as standard checkpoints that can be shared on the Hub and loaded on other hardware. Some limits remain: compiled code can’t handle changing input shapes yet, and not every image pipeline can be split across chips.

Why it matters

Moving to a new kind of AI chip usually means extra code and workarounds. Making Trainium behave like any other PyTorch device lowers that cost of switching, which could make Amazon’s chips an easier choice for teams watching their budgets. TorchNeuron is still a beta and the post gives few speed figures, so real-world performance is the open question.

TorchNeuron: running HF models on AWS Trainium is easier than ever

Hugging Face

huggingface.co

Summary by Second Order AI. Full reporting is at the original source.