Hugging Face integrates TorchTPU for native PyTorch support on TPUs

·2026.10.20 09:00

Key point

Transformers, Diffusers, and Kernels now run natively on TPUs using the TorchTPU backend, eliminating the need for torch_xla or JAX.

1 / 6

Details

  • TorchTPU adds TPU as a native PyTorch backend, allowing Hugging Face models to run on TPUs by simply setting device_map="tpu" or pipe.to("tpu").
  • This integration removes the dependency on PyTorch/XLA (torch_xla) and Optimum TPU for running Transformers and Diffusers on Google Cloud TPUs.
  • Performance benchmarks on TPU v6e-4 show Qwen-Image-2.1 generating 1024x1024 images in 3.5 seconds in compiled mode, compared to 8.0 seconds in eager mode.
  • Custom Pallas kernels from the Hugging Face Hub, such as the ragged-dot kernel, achieve 21.5x faster decoding for Qwen3-30B-A3B and 12.8x faster for Gemma 4 26B-A4B at batch size 64 on a TPU v6e-8.
  • Hugging Face is running nightly CI tests on TPUs, with 96.5% of tests currently passing; 34 issues have been reported to the TorchTPU repository, with 19 already fixed.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.