device_map="tpu" gets you running. StaticCache, a Kernels Hub MoE kernel and TensorParallelConfig get you fast, and this post shows why each one changes the numbers.
Series: A five-part, hands-on series for PyTorch engineers moving real workloads onto Cloud TPU v6e (Trillium) and v7x (Ironwood) with TorchTPU. Part 1 builds the mental model (execution modes, memory, profiling, kernels). Part 2 runs Hugging Face Transformers v5 and Diffusers natively. Part 3 serves models in production with vLLM-TorchTPU, SGLang-TorchTPU and llm-d. Part 4 trains and post-trains at pod scale with TorchTitan, Ray and GRPO. Part 5 hands the whole workflow to the TPU Agent Suite.
This is Part 2. Previous: Part 1: TorchTPU Performance: Execution Modes, XProf and Pallas Kernels .…