Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Inferenza di Cloud TPU
Per pubblicazione si intende il processo di deployment di un modello addestrato di machine learning in un ambiente di produzione, dove può essere utilizzato per l'inferenza. L'inferenza è supportata su TPU v5e e versioni successive. Gli SLO di latenza sono una priorità per la gestione.
Questo documento illustra la distribuzione di un modello su una TPU a host singolo. Le sezioni TPU con massimo 8 chip hanno una VM o un host TPU e sono chiamate TPU a host singolo.
Inizia
Per utilizzare Cloud TPU, avrai bisogno di un Google Cloud account e di un progetto. Per maggiori informazioni, consulta Configurare un ambiente Cloud TPU.
Devi richiedere la quota seguente per la pubblicazione sulle TPU:
Risorse v5e on demand: TPUv5 lite pod cores for serving per project per zone
Risorse v5e prerilasciabili: Preemptible TPU v5 lite pod cores for serving per project per zone
Risorse v6e on demand: TPUv6 cores per project per zone
Risorse v6e prerilasciabili: Preemptible TPUv6 cores per project per zone
Per ulteriori informazioni sulla quota TPU, consulta l'articolo sulla quota TPU.
Gestisci gli LLM utilizzando JetStream
JetStream è un motore ottimizzato per la velocità effettiva e la memoria per l'inferenza di modelli linguistici di grandi dimensioni (LLM) su dispositivi XLA (TPU). Puoi usare JetStream con i modelli
JAX e PyTorch/XLA. Per un esempio di utilizzo di JetStream per gestire un LLM JAX, consulta
Inferenza JetStream MaxText su TPU v6e.
Gestisci modelli LLM con vLLM
vLLM è una libreria open source progettata per l'inferenza e la pubblicazione rapide di modelli linguistici di grandi dimensioni (LLM). Puoi utilizzare i modelli vLLM con PyTorch/XLA. Per un esempio di utilizzo di vLLM per gestire un LLM PyTorch, consulta Pubblicare un LLM utilizzando TPU Trillium su GKE con vLLM.
Profilazione
Dopo aver configurato l'inferenza, puoi utilizzare i profiler per analizzare le prestazioni e l'utilizzo della TPU. Per ulteriori informazioni sulla profilazione, consulta:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Cloud TPU inference\n===================\n\n| **Note:** If you are new to Cloud TPUs, see [Introduction to Cloud TPU](/tpu/docs/intro-to-tpu).\n\nServing refers to the process of deploying a trained machine learning model to a\nproduction environment, where it can be used for inference. Inference is\nsupported on TPU v5e and newer versions. Latency SLOs are a priority for serving.\n\nThis document discusses serving a model on a *single-host* TPU. TPU slices with\n8 or less chips have one TPU VM or host and are called *single-host* TPUs.\n\nGet started\n-----------\n\nYou will need a Google Cloud account and project to use Cloud TPU. For more\ninformation, see [Set up a Cloud TPU environment](/tpu/docs/setup-gcp-account).\n\nYou need to request the following quota for serving on TPUs:\n\n- On-demand v5e resources: `TPUv5 lite pod cores for serving per project per zone`\n- Preemptible v5e resources: `Preemptible TPU v5 lite pod cores for serving per project per zone`\n- On-demand v6e resources: `TPUv6 cores per project per zone`\n- Preemptible v6e resources: `Preemptible TPUv6 cores per project per zone`\n\n| **Note:** There is no v6e quota specific to serving.\n\nFor more information about TPU quota, see [TPU quota](/tpu/docs/quota).\n\nServe LLMs using JetStream\n--------------------------\n\nJetStream is a throughput and memory optimized engine for large language model\n(LLM) inference on XLA devices (TPUs). You can use JetStream with JAX and\nPyTorch/XLA models. For an example of using JetStream to serve a JAX LLM, see\n[JetStream MaxText inference on v6e TPU](/tpu/docs/tutorials/LLM/jetstream-maxtext-inference-v6e).\n\nServe LLM models with vLLM\n--------------------------\n\nvLLM is an open-source library designed for fast inference and serving of large\nlanguage models (LLMs). You can use vLLM with PyTorch/XLA. For an example of\nusing vLLM to serve a PyTorch LLM, see [Serve an LLM using TPU Trillium on GKE with vLLM](/kubernetes-engine/docs/tutorials/serve-vllm-tpu).\n\nProfiling\n---------\n\nAfter setting up inference, you can use profilers to analyze the performance and\nTPU utilization. For more information about profiling, see:\n\n- [Profiling on Cloud TPU](/tpu/docs/profile-tpu-vm)\n\n- [TensorFlow profiling](https://www.tensorflow.org/guide/profiler)\n\n- [PyTorch profiling](/tpu/docs/pytorch-xla-performance-profiling-tpu-vm)\n\n- [JAX profiling](https://jax.readthedocs.io/en/latest/profiling.html#profiling-jax-programs)"]]