AIToday
AI Coding AssistantsOpen-Source AIHugging Face BlogPublished: Oct 21, 2026, 01:00 JST

Hugging Face brings native TPU support to PyTorch with TorchTPU

Send on LINE
Hugging Face brings native TPU support to PyTorch with TorchTPU

3 Key Points

  1. What happened

    Hugging Face said TorchTPU adds TPU as a native PyTorch backend, so Transformers, Diffusers and Kernels run on TPU by setting device_map="tpu" — no torch_xla or Optimum TPU needed.

  2. Why it matters

    Developers can pick a model from the Hub and send it to "tpu" without maintaining a TPU fork, which should lower the barrier to using Hugging Face libraries on TPU hardware.

WHO IT HITSMachine learning engineers and developers who use Hugging Face libraries and want to run models on Google Cloud TPUs can now do so with regular PyTorch code, rather than porting to torch_xla or learning a different framework.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Until now, running PyTorch on TPUs typically meant going through PyTorch/XLA (torch_xla), a path with quirks such as lazy tensors and hard-to-reason debugging. Hugging Face had built Optimum TPU to give its models inference and training support on TPUs, but that added another layer. TorchTPU changes the setup by making TPU just another device in PyTorch, so the same code runs without a TPU-specific fork. The body also notes that TPUs are Google's own AI accelerators, available on Google Cloud from a single chip up to pods of thousands of chips, and that the software stack historically grew up around TensorFlow and JAX. Hugging Face is testing the integration: of the tests that run on TPU, 96.5% pass, and the company has reported 34 issues on the TorchTPU repo, with 19 already fixed. Running on TPU also surfaced bugs in Transformers itself, such as in StaticCache and the Qwen3 tensor-parallel plans, which were fixed upstream.

FAQ
How do I load a Hugging Face model on a TPU now?
Pass device_map="tpu" to from_pretrained, or call pipe.to("tpu") for Diffusers pipelines. The model then runs in eager mode by default, with optional torch.compile for better performance.
Is Optimum TPU still needed?
No. With TorchTPU's native support, Optimum TPU is not required anymore to run Hugging Face models with Transformers and Diffusers.
What performance gains does the TPU kernel provide?
At batch size 64, decoding is 21.5× faster on Qwen3-30B-A3B and 12.8× faster on Gemma 4 26B-A4B using a Hub kernel compared with the default implementation.
Hugging Face BlogRead Original Article
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleAtScale semantic layer bridges agents and BI on Amazon Bedrock AgentCore