このページでは、Vertex AI の PyTorch 統合について説明します。また、Vertex AI で PyTorch を使用する方法を説明するリソースについて紹介します。Vertex AI の PyTorch 統合を使用すると、本番環境で PyTorch モデルのトレーニング、デプロイ、オーケストレーションを容易に行うことができます。
ノートブックでコードを実行する
Vertex AI には、ノートブックでコードを実行する方法として Colab Enterprise と Vertex AI Workbench という 2 つのオプションがあります。これらのオプションの詳細については、ノートブック ソリューションを選択するをご覧ください。
トレーニング用のビルド済みコンテナ
Vertex AI には、モデル トレーニング用にビルド済みの Docker コンテナ イメージが用意されています。これらのコンテナは ML フレームワークとフレームワーク バージョン別に編成され、トレーニング コードで必要となる一般的な依存関係が含まれています。ビルド済みのトレーニング コンテナを使用する PyTorch バージョンと、ビルド済みのトレーニング コンテナでモデルをトレーニングする方法については、カスタム トレーニング用のビルド済みコンテナをご覧ください。
予測を提供するためのビルド済みコンテナ
Vertex AI には、バッチ予測とオンライン予測の両方を提供するビルド済みの Docker コンテナ イメージが用意されています。これらのコンテナは ML フレームワークとフレームワーク バージョン別に編成され、予測コードで必要となる一般的な依存関係が含まれています。ビルド済みの予測コンテナを含む PyTorch バージョンと、ビルド済みの予測コンテナでモデルを提供する方法については、カスタム トレーニング用のビルド済みコンテナをご覧ください。
分散トレーニング
Vertex AI では、PyTorch モデルの分散トレーニングを実行できます。マルチワーカー トレーニングの場合、Reduction Server を使用して、all-reduce グループ演算に合わせてパフォーマンスをさらに最適化できます。Vertex AI での分散トレーニングの詳細については、分散トレーニングをご覧ください。
Vertex AI で PyTorch を使用するためのリソース
Vertex AI での PyTorch の詳細とそれを使用する方法については、次のリソースをご覧ください。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-12-23 UTC。"],[],[],null,["# PyTorch integration\n\n| To see an example of PyTorch integration,\n| run the \"Training, tuning and deploying a PyTorch text sentiment classification model\" notebook in one of the following\n| environments:\n|\n| [Open in Colab](https://colab.research.google.com/github/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb)\n|\n|\n| \\|\n|\n| [Open in Colab Enterprise](https://console.cloud.google.com/vertex-ai/colab/import/https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fvertex-ai-samples%2Fmain%2Fnotebooks%2Fofficial%2Ftraining%2Fpytorch-text-sentiment-classification-custom-train-deploy.ipynb)\n|\n|\n| \\|\n|\n| [Open\n| in Vertex AI Workbench](https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fvertex-ai-samples%2Fmain%2Fnotebooks%2Fofficial%2Ftraining%2Fpytorch-text-sentiment-classification-custom-train-deploy.ipynb)\n|\n|\n| \\|\n|\n[View on GitHub](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/training/pytorch-text-sentiment-classification-custom-train-deploy.ipynb) \n\nThis page explains Vertex AI's PyTorch integration and provides resources\nthat show you how to use PyTorch on Vertex AI. Vertex AI's PyTorch\nintegration makes it easier for you to train, deploy, and orchestrate PyTorch\nmodels in production.\n\nRun code in notebooks\n---------------------\n\nVertex AI provides two options for running your code in\nnotebooks, Colab Enterprise and Vertex AI Workbench.\nTo learn more about these options, see\n[choose a notebook solution](/vertex-ai/docs/workbench/notebook-solution).\n\nPrebuilt containers for training\n--------------------------------\n\nVertex AI provides prebuilt Docker container images for model training.\nThese containers are organized by machine learning frameworks and framework\nversions and include common dependencies that you might want to use in your\ntraining code. To learn about which PyTorch versions have prebuilt training\ncontainers and how to train models with a prebuilt training container, see\n[Prebuilt containers for custom training](/vertex-ai/docs/training/pre-built-containers#pytorch).\n\nPrebuilt containers for serving inferences\n------------------------------------------\n\nVertex AI provides prebuilt Docker container images for serving both\nbatch and online inferences.\nThese containers are organized by machine learning frameworks and framework\nversions and include common dependencies that you might want to use in your\ninference code. To learn about which PyTorch versions have prebuilt inference\ncontainers and how to serve models with a prebuilt inference container, see\n[Prebuilt containers for custom training](/vertex-ai/docs/predictions/pre-built-containers).\n\nDistributed training\n--------------------\n\nYou can run distributed training of PyTorch models on Vertex AI. For\nmulti-worker training, you can use Reduction Server to optimize performance\neven further for all-reduce collective operations. To learn more about\ndistributed training on Vertex AI, see\n[Distributed training](/vertex-ai/docs/training/distributed-training).\n\nResources for using PyTorch on Vertex AI\n----------------------------------------\n\nTo learn more and start using PyTorch in Vertex AI, see the following\nresources:\n\n- [How to train and tune PyTorch models on Vertex AI](https://cloud.google.com/blog/topics/developers-practitioners/pytorch-google-cloud-how-train-and-tune-pytorch-models-vertex-ai): Learn how to use [Vertex AI Training](/vertex-ai/docs/training/overview) to build and train a sentiment text classification model using PyTorch and [Vertex AI Hyperparameter Tuning](/vertex-ai/docs/training/using-hyperparameter-tuning) to tune hyperparameters of PyTorch models.\n- [How to deploy PyTorch models on Vertex AI](https://cloud.google.com/blog/topics/developers-practitioners/pytorch-google-cloud-how-deploy-pytorch-models-vertex-ai): Walk through the deployment of a Pytorch model using [TorchServe](https://pytorch.org/serve/) as a custom container, by deploying the model artifacts to a [Vertex AI Inference](/vertex-ai/docs/predictions/overview) service.\n- [Orchestrating PyTorch ML Workflows on Vertex AI Pipelines](https://cloud.google.com/blog/topics/developers-practitioners/orchestrating-pytorch-ml-workflows-vertex-ai-pipelines): See how to build and orchestrate ML pipelines for training and deploying PyTorch models on Google Cloud Vertex AI using [Vertex AI Pipelines](/vertex-ai/docs/pipelines/introduction).\n- [Scalable ML Workflows using PyTorch on Kubeflow Pipelines and Vertex Pipelines](https://cloud.google.com/blog/topics/developers-practitioners/scalable-ml-workflows-using-pytorch-kubeflow-pipelines-and-vertex-pipelines): Take a look at examples of [PyTorch](https://pytorch.org/)-based ML workflows on OSS [Kubeflow Pipelines](https://www.kubeflow.org/docs/components/pipelines/), (part of the Kubeflow project) and [Vertex AI Pipelines](/vertex-ai/docs/pipelines). We share [new PyTorch built-in components](https://github.com/kubeflow/pipelines/tree/master/components/PyTorch/pytorch-kfp-components) added to the Kubeflow Pipelines.\n- [Serving PyTorch image models with prebuilt containers on\n Vertex AI](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/prediction/pytorch_image_classification_with_prebuilt_serving_containers.ipynb): This notebook deploys a PyTorch image classification model on Vertex AI using prebuilt PyTorch serving images.\n\nWhat's next\n-----------\n\n- Tutorial: Use Vertex AI to train a PyTorch image classification model in one of Vertex AI's prebuilt container environments by using the Google Cloud console.\n\n *** ** * ** ***\n\n To follow step-by-step guidance for this task directly in the\n Google Cloud console, click **Guide me**:\n\n [Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=vertex-pytorch-custom-training)\n\n *** ** * ** ***"]]