---
title: "Google 開源 TorchTPU 令 PyTorch 原生跑上 TPU"
url: https://sammy.hk/google-%e9%96%8b%e6%ba%90-torchtpu-%e4%bb%a4-pytorch-%e5%8e%9f%e7%94%9f%e8%b7%91%e4%b8%8a-tpu/
author: Ethan
published: 2026-10-21T20:41:00+08:00
modified: 2026-10-21T09:04:20+08:00
description: "Google Cloud 於二〇二六年十月二十日在 PyTorch Conference 2026 宣布，專為 Google TPU 而設計的原生 PyTorch 壓縮 TorchTPU 正式開源，代碼已放上 GitHub。TorchTPU 由 Google 與 Meta 的 PyTorch 圖譜共同開發，令 TPU …"
categories: [AI]
tags: [google, PyTorch, TorchTPU, TPU, "開源"]
source: https://sammy.hk
---
![Google open sources TorchTPU for native PyTorch on TPUs](https://sammy.hk/wp-content/uploads/2026/10/openrouter_google_gemini-3_1-flash-lite-image_20261021_090336_e7c1e81f.jpg)Google Cloud 於二〇二六年十月二十日在 PyTorch Conference 2026 宣布，專為 Google TPU 而設計的原生 PyTorch 壓縮 TorchTPU 正式開源，代碼已放上 GitHub。TorchTPU 由 Google 與 Meta 的 PyTorch 圖譜共同開發，令 TPU 與 GPU、CPU 並列成為 PyTorch 的原生選項，現有 PyTorch 工作負載只需極少改動，即可在 TPU 上訓練、服務與部署。\[1\]

## 除錯與效能的雙軌路

TorchTPU 支援標準 PyTorch API、進階斷點工具與原生分布式原語。開發者可以先用 eager mode 除錯模型，再透過 torch.compile 過渡至正式環境的效能水平，以提升 TPU 使用率並減少記憶體開銷。Google 稱這套組合讓開發者由第一天起即可取得高效能與彈運效能，並在 TPU、GPU 與 CPU 之間按工作負載選擇合適硬體。\[1\]

## 服務引擎與分布式推論接上

推論方面，TorchTPU 已接入多個主流開源服務引擎。與 Inferact 合作的原生 PyTorch vLLM 後端，支援連續批次推理、量化與多晶片平行，並保留上游的 worker 模型、排程器與 API 代理服務器；與 RadixArk 合作的 SGLang 後端，透過 RadixAttention 重用 KV 快取，讓重複的提示前綴跳過重算。\[1\] 分布式推論方面，Google 與 Red Hat、IBM 及二十五個組織、超過五百名貢獻者提出 llm-d 1.0，項目旨在雲原生運算基礎金會沙盒級別，提供前綴快取感知路由，並把運算密集的 prefill 與記憶體密集的 decode 分開處理。\[1\]

## 模型庫與訓練框架的支援

Hugging Face 方面，Transformers v5 把模型部署至 TPU 只需設定 device\_map=”tpu”;Diffusers 原生支援 eager mode、torch.compile 與張量平行，並設置有 nightly 測試流程在 TPU 上持續驗證。\[1\] 訓練方面，TorchTitan 已驗證可運行至八千塊 Ironwood TPU（TPU v7x），在 Qwen 3 8B 上透過 TorchTPU 的訓練路徑達到最高百分之五十二的模型運算利用率，並在最多八千一百九十二塊 Ironwood TPU 上展示近線性擴展與穩定性。\[1\] TorchTitan 同提提供 Llama 3 70B 與 405B、Qwen 3 8B 與 32B、MuseGlimmer 30B、Qwen 3 235B 混合專家模型及 FLUX.1 12B 等預訓練配方。\[1\]

## 代理工具與上手方式

Google 亦把 TPU agent suite 以早期預覽形式放上 GitHub，透過插件與多種編碼工具及模型組合，協助開發者上手、診斷問題、解答疑問及調校推論效能。\[1\] 開發者可在 Google Cloud 文件查閱在 TPU 上運行 PyTorch 的指引，源碼碼庫在 GitHub 公開。\[1\]\[2\] 對長期受制於單一硬體架構的圖譜而言，TorchTPU 開源意味著 PyTorch 生態多了一個可自行檢視與參與的後端，硬體選擇也不再限於 GPU。\[1\]

## 參考資料

\[1\] [TorchTPU is now open source: Run native PyTorch on TPUs (2026-10-20)](https://cloud.google.com/blog/topics/ai-infrastructure/torchtpu-is-now-open-source-run-native-pytorch-on-tpus)

\[2\] [google-pytorch/torch\_tpu：GitHub 源碼庫](https://github.com/google-pytorch/torch_tpu)

### 相關文章：

1. [Google Project Suncatcher 首次在軌測試：把 TPU 送上太空](https://sammy.hk/google-project-suncatcher-%e9%a6%96%e6%ac%a1%e5%9c%a8%e8%bb%8c%e6%b8%ac%e8%a9%a6%ef%bc%9a%e6%8a%8a-tpu-%e9%80%81%e4%b8%8a%e5%a4%aa%e7%a9%ba/ "Google Project Suncatcher 首次在軌測試：把 TPU 送上太空")
2. [Project Suncatcher 原型衛星入軌：Google 開始收集太空 TPU 數據](https://sammy.hk/project-suncatcher-%e5%8e%9f%e5%9e%8b%e8%a1%9b%e6%98%9f%e5%85%a5%e8%bb%8c%ef%bc%9agoogle-%e9%96%8b%e5%a7%8b%e6%94%b6%e9%9b%86%e5%a4%aa%e7%a9%ba-tpu-%e6%95%b8%e6%93%9a/ "Project Suncatcher 原型衛星入軌：Google 開始收集太空 TPU 數據")
3. [AWS 開源 TorchNeuron 讓 PyTorch 程式改一行即跑上 Trainium](https://sammy.hk/aws-%e9%96%8b%e6%ba%90-torchneuron-%e8%ae%93-pytorch-%e7%a8%8b%e5%bc%8f%e6%94%b9%e4%b8%80%e8%a1%8c%e5%8d%b3%e8%b7%91%e4%b8%8a-trainium/ "AWS 開源 TorchNeuron 讓 PyTorch 程式改一行即跑上 Trainium")
4. [Google 推出 Sheets canvas：一句話將試算表變成互動迷你應用](https://sammy.hk/google-%e6%8e%a8%e5%87%ba-sheets-canvas%ef%bc%9a%e4%b8%80%e5%8f%a5%e8%a9%b1%e5%b0%87%e8%a9%a6%e7%ae%97%e8%a1%a8%e8%ae%8a%e6%88%90%e4%ba%92%e5%8b%95%e8%bf%b7%e4%bd%a0%e6%87%89%e7%94%a8/ "Google 推出 Sheets canvas：一句話將試算表變成互動迷你應用")
