Skip to content

Commit 60edb06

Browse files
committed
Move to recipes
Moving this tutorial to recipes folder as it is more of a recipe.
1 parent 89f791c commit 60edb06

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

index.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ What's new in PyTorch tutorials?
286286
:header: Introduction to ONNX Registry
287287
:card_description: Demonstrate end-to-end how to address unsupported operators by using ONNX Registry.
288288
:image: _static/img/thumbnails/cropped/Exporting-PyTorch-Models-to-ONNX-Graphs.png
289-
:link: advanced/onnx_registry_tutorial.html
289+
:link: advanced/onnx_registry_tutorial.html
290290
:tags: Production,ONNX,Backends
291291

292292
.. Reinforcement Learning
@@ -637,13 +637,6 @@ What's new in PyTorch tutorials?
637637
:link: beginner/knowledge_distillation_tutorial.html
638638
:tags: Model-Optimization,Image/Video
639639

640-
.. customcarditem::
641-
:header: Deploying a PyTorch Stable Diffusion model as a Vertex AI Endpoint
642-
:card_description: Learn how to deploy model in Vertex AI with TorchServe
643-
:image: _static/img/thumbnails/cropped/generic-pytorch-logo.png
644-
:link: intermediate/torchserve_vertexai_tutorial.rst
645-
:tags: Model-Optimization,Production
646-
647640
.. Parallel-and-Distributed-Training
648641
649642
@@ -1049,7 +1042,7 @@ Additional Resources
10491042
intermediate/inductor_debug_cpu
10501043
intermediate/scaled_dot_product_attention_tutorial
10511044
beginner/knowledge_distillation_tutorial
1052-
intermediate/torchserve_vertexai_tutorial.rst
1045+
10531046

10541047
.. toctree::
10551048
:maxdepth: 2

recipes_source/recipes_index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,15 @@ Recipes are bite-sized, actionable examples of how to use specific PyTorch featu
324324
:link: ../recipes/DCP_tutorial.html
325325
:tags: Distributed-Training
326326

327+
.. TorchServe
328+
329+
.. customcarditem::
330+
:header: Deploying a PyTorch Stable Diffusion model as a Vertex AI Endpoint
331+
:card_description: Learn how to deploy model in Vertex AI with TorchServe
332+
:image: ../_static/img/thumbnails/cropped/generic-pytorch-logo.png
333+
:link: ../recipes/torchserve_vertexai_tutorial.html
334+
:tags: Production
335+
327336
.. End of tutorial card section
328337
329338
.. raw:: html

intermediate_source/torchserve_vertexai_tutorial.rst renamed to recipes_source/torchserve_vertexai_tutorial.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ Deploying a PyTorch Stable Diffusion model as a Vertex AI Endpoint
22
==================================================================
33

44
Deploying large models, like Stable Diffusion, can be challenging and time-consuming.
5-
In this tutorial, we will show how you can streamline the deployment of a PyTorch Stable Diffusion
6-
model by leveraging Vertex AI. PyTorch is the framework used by Stability AI on Stable
5+
6+
In this recipe, we will show how you can streamline the deployment of a PyTorch Stable Diffusion
7+
model by leveraging Vertex AI.
8+
9+
PyTorch is the framework used by Stability AI on Stable
710
Diffusion v1.5. Vertex AI is a fully-managed machine learning platform with tools and
811
infrastructure designed to help ML practitioners accelerate and scale ML in production with
9-
the benefit of open-source frameworks like PyTorch. In four steps you can deploy a PyTorch
10-
Stable Diffusion model (v1.5).
12+
the benefit of open-source frameworks like PyTorch.
13+
14+
In four steps you can deploy a PyTorch Stable Diffusion model (v1.5).
1115

1216
Deploying your Stable Diffusion model on a Vertex AI Endpoint can be done in four steps:
1317

@@ -22,14 +26,14 @@ Deploying your Stable Diffusion model on a Vertex AI Endpoint can be done in fou
2226
Let’s have a look at each step in more detail. You can follow and implement the steps using the
2327
`Notebook example <https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stablediffusion.ipynb>`__.
2428

25-
NOTE: please keep in mind that this tutorial requires a billable Vertex AI as explained in more details in the notebook example.
29+
NOTE: Please keep in mind that this recipe requires a billable Vertex AI as explained in more details in the notebook example.
2630

2731
Create a custom TorchServe handler
2832
----------------------------------
2933

3034
TorchServe is an easy and flexible tool for serving PyTorch models. The model deployed to Vertex AI
31-
uses TorchServe to handle requests and return responses from the model. You must create a custom
32-
TorchServe handler to include in the model artifacts uploaded to Vertex AI. Include the handler file in the
35+
uses TorchServe to handle requests and return responses from the model.
36+
You must create a custom TorchServe handler to include in the model artifacts uploaded to Vertex AI. Include the handler file in the
3337
directory with the other model artifacts, like this: `model_artifacts/handler.py`.
3438

3539
After creating the handler file, you must package the handler as a model archiver (MAR) file.
@@ -70,7 +74,7 @@ Once you've uploaded the model artifacts into a GCS bucket, you can upload your
7074
From the Vertex AI Model Registry, you have an overview of your models
7175
so you can better organize, track, and train new versions. For this you can use the
7276
`Vertex AI SDK <https://cloud.google.com/vertex-ai/docs/python-sdk/use-vertex-ai-python-sdk>`__
73-
and this
77+
and this
7478
`pre-built PyTorch container <https://cloud.google.com/blog/products/ai-machine-learning/prebuilt-containers-with-pytorch-and-vertex-ai>`__.
7579

7680

@@ -97,7 +101,7 @@ Deploy the Vertex AI model onto an endpoint
97101

98102
Once the model has been uploaded to Vertex AI Model Registry you can then take it and deploy
99103
it to an Vertex AI Endpoint. For this you can use the Console or the Vertex AI SDK. In this
100-
example you will deploy the model on a NVIDIA Tesla P100 GPU and n1-standard-8 machine. You can
104+
example you will deploy the model on a NVIDIA Tesla P100 GPU and n1-standard-8 machine. You can
101105
specify your machine type.
102106

103107

@@ -116,7 +120,7 @@ specify your machine type.
116120
sync=True,
117121
)
118122
119-
If you follow the
123+
If you follow this
120124
`notebook <https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/vertex_endpoints/torchserve/dreambooth_stablediffusion.ipynb>`__
121125
you can also get online predictions using the Vertex AI SDK as shown in the following snippet.
122126

@@ -138,4 +142,3 @@ More resources
138142

139143
This tutorial was created using the vendor documentation. To refer to the original documentation on the vendor site, please see
140144
`torchserve example <https://cloud.google.com/blog/products/ai-machine-learning/get-your-genai-model-going-in-four-easy-steps>`__.
141-

0 commit comments

Comments
 (0)