# Hugging Face ❤ TorchTPU: TPUs, Natively

DevFeed: [Hugging Face ❤ TorchTPU: TPUs, Natively](<https://devfeed.tech/articles/hugging-face-torchtpu-tpus-natively-91097.md>)

Original publisher: [Read original article](<https://huggingface.co/blog/hf-torchtpu>)

Author: Alvaro Moran; Jingya Huang; Simon Pagezy; Jeff Boudier; Régis Pierrard

Published: 2026-10-20T00:00:00Z

Content type: release

Language: en

Sources: [Hugging Face](<https://devfeed.tech/sources/hugging-face-blog.md>)

Topics: [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [distributed-training](<https://devfeed.tech/topics/distributed-training.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [accelerators](<https://devfeed.tech/tags/accelerators.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-accelerators](<https://devfeed.tech/tags/ai-accelerators.md>), [chip](<https://devfeed.tech/tags/chip.md>), [chips](<https://devfeed.tech/tags/chips.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cloud-tpu](<https://devfeed.tech/tags/cloud-tpu.md>), [cuda](<https://devfeed.tech/tags/cuda.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [decoding](<https://devfeed.tech/tags/decoding.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [diffusers](<https://devfeed.tech/tags/diffusers.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [distributed-training](<https://devfeed.tech/tags/distributed-training.md>), [ecosystem](<https://devfeed.tech/tags/ecosystem.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [google](<https://devfeed.tech/tags/google.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [hugging-face](<https://devfeed.tech/tags/hugging-face.md>), [kernels](<https://devfeed.tech/tags/kernels.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [partnerships](<https://devfeed.tech/tags/partnerships.md>), [science](<https://devfeed.tech/tags/science.md>), [torchtpu](<https://devfeed.tech/tags/torchtpu.md>), [tpu](<https://devfeed.tech/tags/tpu.md>), [tpus](<https://devfeed.tech/tags/tpus.md>), [transformers](<https://devfeed.tech/tags/transformers.md>)

## AI overview

TorchTPU adds TPU as a native PyTorch device, so Hugging Face Transformers and Diffusers models can run on TPU without the former Optimum TPU layer. Install `torch-tpu` on a TPU VM with the PyTorch CPU package index, then load Transformers models with `device_map="tpu"` or move Diffusers pipelines with `.to("tpu")`. Eager mode supports prototyping; `torch.compile` can be used for faster execution, with compiled Diffusers graphs reused for later calls at the same image size. `TensorParallelConfig` can shard large models across chips as they load. TorchTPU also provides Pallas kernels, distributed training, and `torch.compile` integration. The excerpt reports Hub-kernel decoding speedups at batch size 64 on TPU v6e-8, while noting TPU test results are not yet fully green: 96.5% of tests that run pass, with 19 of 34 reported issues fixed.

## Source excerpt

We're on a journey to advance and democratize artificial intelligence through open source and open science.