You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Batch Endpoints can be used for processing tabular data, but also any other file type like text. Those deployments are supported in both MLflow and custom models. In this tutorial we will learn how to deploy a model that can perform text summarization of long sequences of text using a model from HuggingFace.
20
+
Batch Endpoints can be used for processing tabular data that contain text. Those deployments are supported in both MLflow and custom models. In this tutorial we will learn how to deploy a model that can perform text summarization of long sequences of text using a model from HuggingFace.
21
21
22
22
## About this sample
23
23
@@ -27,13 +27,26 @@ The model we are going to work with was built using the popular library transfor
27
27
* It is trained for summarization of text in English.
28
28
* We are going to use Torch as a backend.
29
29
30
-
The information in this article is based on code samples contained in the [azureml-examples](https://github.com/azure/azureml-examples) repository. To run the commands locally without having to copy/paste YAML and other files, clone the repo and then change directories to the `cli/endpoints/batch/deploy-models/huggingface-text-summarization` if you are using the Azure CLI or `sdk/python/endpoints/batch/deploy-models/huggingface-text-summarization` if you are using our SDK for Python.
30
+
The information in this article is based on code samples contained in the [azureml-examples](https://github.com/azure/azureml-examples) repository. To run the commands locally without having to copy/paste YAML and other files, clone the repo and then change directories to the [`cli/endpoints/batch/deploy-models/huggingface-text-summarization`](https://github.com/azure/azureml-examples/tree/main/cli/endpoints/batch/deploy-models/huggingface-text-summarization) if you are using the Azure CLI or [`sdk/python/endpoints/batch/deploy-models/huggingface-text-summarization`](https://github.com/azure/azureml-examples/tree/main/sdk/python/endpoints/batch/deploy-models/huggingface-text-summarization) if you are using our SDK for Python.
You can follow along this sample in a Jupyter Notebook. In the cloned repository, open the notebook: [text-summarization-batch.ipynb](https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/batch/deploy-models/huggingface-text-summarization/text-summarization-batch.ipynb).
@@ -46,7 +59,7 @@ You can follow along this sample in a Jupyter Notebook. In the cloned repository
46
59
47
60
First, let's connect to Azure Machine Learning workspace where we're going to work on.
Due to the size of the model, it hasn't been included in this repository. Instead, you can generate a local copy with the following code. A local copy of the model will be placed at `model`. We will use it during the course of this tutorial.
96
+
Due to the size of the model, it hasn't been included in this repository. Instead, you can download a copy from the HuggingFace model's hub. You need the packages `transformers` and `torch` installed in the environment you are using.
97
+
98
+
```python
99
+
%pip install transformers torch
100
+
```
101
+
102
+
Use the following code to download the model to a folder `model`:
az ml model create --name $MODEL_NAME --path "model"
100
119
```
101
120
102
-
# [Python](#tab/sdk)
121
+
# [Python](#tab/python)
103
122
104
123
```python
105
124
model_name ='bart-text-summarization'
@@ -115,7 +134,7 @@ We are going to create a batch endpoint named `text-summarization-batch` where t
115
134
116
135
1. Decide on the name of the endpoint. The name of the endpoint will end-up in the URI associated with your endpoint. Because of that, __batch endpoint names need to be unique within an Azure region__. For example, there can be only one batch endpoint with the name `mybatchendpoint` in `westus2`.
117
136
118
-
# [Azure CLI](#tab/azure-cli)
137
+
# [Azure CLI](#tab/cli)
119
138
120
139
In this case, let's place the name of the endpoint in a variable so we can easily reference it later.
121
140
@@ -133,7 +152,7 @@ We are going to create a batch endpoint named `text-summarization-batch` where t
133
152
134
153
1. Configure your batch endpoint
135
154
136
-
# [Azure CLI](#tab/azure-cli)
155
+
# [Azure CLI](#tab/cli)
137
156
138
157
The following YAML file defines a batch endpoint:
139
158
@@ -156,7 +175,7 @@ We are going to create a batch endpoint named `text-summarization-batch` where t
@@ -217,7 +236,7 @@ Let's create the deployment that will host the model:
217
236
218
237
1. Each deployment runs on compute clusters. They support both [Azure Machine Learning Compute clusters (AmlCompute)](./how-to-create-attach-compute-cluster.md) or [Kubernetes clusters](./how-to-attach-kubernetes-anywhere.md). In this example, our model can benefit from GPU acceleration, which is why we will use a GPU cluster.
0 commit comments