Skip to content

Commit e63a8f5

Browse files
authored
embed score.py instead of just linking it
1 parent 66b8af3 commit e63a8f5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

articles/machine-learning/how-to-deploy-online-endpoints.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,18 @@ For supported general-purpose and GPU instance types, see [Managed online endpoi
375375

376376
### Use more than one model
377377

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).
379379

380380
## Understand the scoring script
381381

382382
> [!TIP]
383383
> 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.
384384

385385
# [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.
387387

388388
# [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.
390390

391391
# [ARM template](#tab/arm)
392392

@@ -404,6 +404,10 @@ When using a template for deployment, you must first upload the scoring file(s)
404404

405405
---
406406

407+
This example uses the [score.py file](https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/online/model-1/onlinescoring/score.py):
408+
__score.py__
409+
:::code language="python" source="~/azureml-examples-main/cli/endpoints/online/model-1/onlinescoring/score.py" :::
410+
407411
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 for global 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 JSON input, call the scikit-learn model's `predict()` method, and then return the result.
408412

409413
## Deploy and debug locally by using local endpoints

0 commit comments

Comments
 (0)