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
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-deploy-online-endpoints.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ The main example in this doc uses managed online endpoints for deployment. To us
62
62
# [ARM template](#tab/arm)
63
63
64
64
> [!NOTE]
65
-
> While the Azure CLI and CLI extension for machine learning are used in these steps, they are not the main focus. They are used more as utilities, passing templates to Azure and checking the status of template deployments.
65
+
> While the Azure CLI and CLI extension for machine learning are used in these steps, they're not the main focus. they're used more as utilities, passing templates to Azure and checking the status of template deployments.
1. Part of the environment is a conda file that specifies the model dependencies needed to host the model. The following example demonstrates how to read the contents of the conda file into an environment variables:
357
+
1. Part of the environment is a conda file that specifies the model dependencies needed to host the model. The following example demonstrates how to read the contents of the conda file into environment variables:
@@ -375,35 +375,39 @@ For supported general-purpose and GPU instance types, see [Managed online endpoi
375
375
376
376
### Use more than one model
377
377
378
-
Currently, you can specify only one model per deployment in the YAML. If you've more than one model, when you register the model, copy all the models as files or subdirectories into a folder that you use for registration. In your scoring script, use the environment variable `AZUREML_MODEL_DIR` to get the path to the model root folder. The underlying directory structure is retained. For an example of deploying multiple models to one deployment, see [Deploy multiple models to one deployment](https://github.com/Azure/azureml-examples/blob/main/cli/endpoints/online/custom-container/minimal/multimodel/README.md).
378
+
Currently, you can specify only one model per deployment in the YAML. If you've more than one model, when you register the model, copy all the models as files or subdirectories into a folder that you use for registration. In your scoring script, use the environment variable `AZUREML_MODEL_DIR` to get the path to the model root folder. The underlying directory structure is retained. For an example of deploying multiple models to one deployment, see [Deploy multiple models to one deployment](https://github.com/Azure/azureml-examples/blob/main/cli/endpoints/online/custom-container/minimal/multimodel).
379
379
380
380
## Understand the scoring script
381
381
382
382
> [!TIP]
383
383
> The format of the scoring script for online endpoints is the same format that's used in the preceding version of the CLI and in the Python SDK.
384
384
385
385
# [Azure CLI](#tab/azure-cli)
386
-
As noted earlier, the script specified in`code_configuration.scoring_script` must have an `init()` function and a `run()` function. This example uses the [score.py file](https://github.com/Azure/azureml-examples/blob/main/cli/endpoints/online/model-1/onlinescoring/score.py).
386
+
As noted earlier, the script specified in`code_configuration.scoring_script` must have an `init()` function and a `run()` function.
387
387
388
388
# [Python](#tab/python)
389
-
As noted earlier, the script specified in`CodeConfiguration(scoring_script="score.py")` must have an `init()` function and a `run()` function. This example uses the [score.py file](https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/online/model-1/onlinescoring/score.py).
389
+
As noted earlier, the script specified in`CodeConfiguration(scoring_script="score.py")` must have an `init()` function and a `run()` function.
390
390
391
391
# [ARM template](#tab/arm)
392
392
393
393
As noted earlier, the script specified in`code_configuration.scoring_script` must have an `init()` function and a `run()` function. This example uses the [score.py file](https://github.com/Azure/azureml-examples/blob/main/cli/endpoints/online/model-1/onlinescoring/score.py).
394
394
395
-
When using a template for deployment, you must first upload the scoring file(s) to an Azure Blob store and then register it:
395
+
When using a template for deployment, you must first upload the scoring file(s) to an Azure Blob store,and then register it:
396
396
397
397
1. The following example uses the Azure CLI command `az storage blob upload-batch` to upload the scoring file(s):
The `init()` function is called when the container is initialized or started. Initialization typically occurs shortly after the deployment is created or updated. Write logic here forglobal initialization operations like caching the model in memory (as we do in this example). The `run()` function is called for every invocation of the endpoint and should do the actual scoring and prediction. In the example, we extract the data from the JSONinput, call the scikit-learn model's `predict()` method, and then return the result.
408
412
409
413
## Deploy and debug locally by using local endpoints
0 commit comments