Reorganize custom container folder (#1746)

* Delete existing examples

* Readd new examples

* Delete old workflows

* Re-add workflows

* Reformat minimal multimodel

* Add model version

* Add model version

* Edit base path

* Edit path

* Edit base path

* Error fixing

* Add half plus two integrated

* Add runner for half-plus-two-integrated

* Delete deploy r workflow

* Add r and test

* Add R readme/test

* Skip script validation

* Add textgen

* Add detached docker

* Revert "Add detached docker"

This reverts commit f2450516e5.

* Detached docker

* Detached docker

* Longer sleep
This commit is contained in:
Alex Wallace 2022-10-13 09:59:35 -07:00 коммит произвёл GitHub
Родитель 027b82e58b
Коммит 37324eaff8
84 изменённых файлов: 862 добавлений и 538 удалений

Просмотреть файл

@ -1,4 +1,4 @@
name: cli-scripts-deploy-torchserve
name: cli-scripts-deploy-custom-container-minimal-multimodel
on:
workflow_dispatch:
schedule:
@ -8,8 +8,8 @@ on:
- main
- sdk-preview
paths:
- cli/deploy-torchserve.sh
- .github/workflows/cli-scripts-deploy-torchserve.yml
- cli/deploy-custom-container-minimal-multimodel.sh
- .github/workflows/cli-scripts-deploy-custom-container-minimal-multimodel.yml
- cli/setup.sh
jobs:
build:
@ -26,5 +26,5 @@ jobs:
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-torchserve.sh
run: set -e; bash -x deploy-custom-container-minimal-multimodel.sh
working-directory: cli

Просмотреть файл

@ -1,4 +1,4 @@
name: cli-scripts-deploy-r
name: cli-scripts-deploy-custom-container-minimal-single-model
on:
workflow_dispatch:
schedule:
@ -8,8 +8,8 @@ on:
- main
- sdk-preview
paths:
- cli/deploy-r.sh
- .github/workflows/cli-scripts-deploy-r.yml
- cli/deploy-custom-container-minimal-single-model.sh
- .github/workflows/cli-scripts-deploy-custom-container-minimal-single-model.yml
- cli/setup.sh
jobs:
build:
@ -26,5 +26,5 @@ jobs:
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; az ml model archive -n plumber -v 1 || true ; bash -x deploy-r.sh
run: set -e; bash -x deploy-custom-container-minimal-single-model.sh
working-directory: cli

Просмотреть файл

@ -1,4 +1,4 @@
name: cli-scripts-deploy-custom-container-mlflow
name: cli-scripts-deploy-custom-container-mlflow-multideployment-scikit
on:
workflow_dispatch:
schedule:
@ -6,9 +6,10 @@ on:
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-mlflow.sh
- .github/workflows/cli-scripts-deploy-custom-container-mlflow.yml
- cli/deploy-custom-container-mlflow-multideployment-scikit.sh
- .github/workflows/cli-scripts-deploy-custom-container-mlflow-multideployment-scikit.yml
- cli/setup.sh
jobs:
build:
@ -24,8 +25,6 @@ jobs:
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: scripts installs
run: sudo apt-get upgrade -y && sudo apt-get install uuid-runtime jq -y
- name: test script script
run: set -e; bash -x deploy-custom-container-mlflow.sh
run: set -e; bash -x deploy-custom-container-mlflow-multideployment-scikit.sh
working-directory: cli

Просмотреть файл

@ -0,0 +1,30 @@
name: cli-scripts-deploy-custom-container-r-multimodel-plumber
on:
workflow_dispatch:
schedule:
- cron: "0 0/4 * * *"
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-r-multimodel-plumber.sh
- .github/workflows/cli-scripts-deploy-custom-container-r-multimodel-plumber.yml
- cli/setup.sh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repo
uses: actions/checkout@v2
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZ_CREDS}}
- name: setup
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-custom-container-r-multimodel-plumber.sh
working-directory: cli

Просмотреть файл

@ -0,0 +1,30 @@
name: cli-scripts-deploy-custom-container-tfserving-half-plus-two-integrated
on:
workflow_dispatch:
schedule:
- cron: "0 0/4 * * *"
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-tfserving-half-plus-two-integrated.sh
- .github/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two-integrated.yml
- cli/setup.sh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repo
uses: actions/checkout@v2
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZ_CREDS}}
- name: setup
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-custom-container-tfserving-half-plus-two-integrated.sh
working-directory: cli

Просмотреть файл

@ -0,0 +1,30 @@
name: cli-scripts-deploy-custom-container-tfserving-half-plus-two
on:
workflow_dispatch:
schedule:
- cron: "0 0/4 * * *"
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-tfserving-half-plus-two.sh
- .github/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two.yml
- cli/setup.sh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repo
uses: actions/checkout@v2
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZ_CREDS}}
- name: setup
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-custom-container-tfserving-half-plus-two.sh
working-directory: cli

Просмотреть файл

@ -1,4 +1,4 @@
name: cli-scripts-deploy-tfserving
name: cli-scripts-deploy-custom-container-torchserve-densenet
on:
workflow_dispatch:
schedule:
@ -8,8 +8,8 @@ on:
- main
- sdk-preview
paths:
- cli/deploy-tfserving.sh
- .github/workflows/cli-scripts-deploy-tfserving.yml
- cli/deploy-custom-container-torchserve-densenet.sh
- .github/workflows/cli-scripts-deploy-custom-container-torchserve-densenet.yml
- cli/setup.sh
jobs:
build:
@ -26,5 +26,5 @@ jobs:
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-tfserving.sh
run: set -e; bash -x deploy-custom-container-torchserve-densenet.sh
working-directory: cli

Просмотреть файл

@ -0,0 +1,30 @@
name: cli-scripts-deploy-custom-container-torchserve-huggingface-textgen
on:
workflow_dispatch:
schedule:
- cron: "0 0/4 * * *"
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-torchserve-huggingface-textgen.sh
- .github/workflows/cli-scripts-deploy-custom-container-torchserve-huggingface-textgen.yml
- cli/setup.sh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repo
uses: actions/checkout@v2
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZ_CREDS}}
- name: setup
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: test script script
run: set -e; bash -x deploy-custom-container-torchserve-huggingface-textgen.sh
working-directory: cli

Просмотреть файл

@ -1,4 +1,4 @@
name: cli-scripts-deploy-custom-container-triton
name: cli-scripts-deploy-custom-container-triton-single-model
on:
workflow_dispatch:
schedule:
@ -6,9 +6,10 @@ on:
pull_request:
branches:
- main
- sdk-preview
paths:
- cli/deploy-custom-container-triton.sh
- .github/workflows/cli-scripts-deploy-custom-container-triton.yml
- cli/deploy-custom-container-triton-single-model.sh
- .github/workflows/cli-scripts-deploy-custom-container-triton-single-model.yml
- cli/setup.sh
jobs:
build:
@ -24,8 +25,6 @@ jobs:
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: scripts installs
run: sudo apt-get upgrade -y && sudo apt-get install uuid-runtime jq -y
- name: test script script
run: set -e; bash -x deploy-custom-container-triton.sh
run: set -e; bash -x deploy-custom-container-triton-single-model.sh
working-directory: cli

Просмотреть файл

@ -1,31 +0,0 @@
name: cli-scripts-deploy-minimal-inference-custom-container
on:
workflow_dispatch:
schedule:
- cron: "0 0/4 * * *"
pull_request:
branches:
- main
paths:
- cli/deploy-minimal-inference-custom-container.sh
- .github/workflows/cli-scripts-deploy-minimal-inference-custom-container.yml
- cli/setup.sh
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check out repo
uses: actions/checkout@v2
- name: azure login
uses: azure/login@v1
with:
creds: ${{secrets.AZ_CREDS}}
- name: setup
run: bash setup.sh
working-directory: cli
continue-on-error: true
- name: scripts installs
run: sudo apt-get upgrade -y && sudo apt-get install uuid-runtime jq -y
- name: test script script
run: set -e; bash -x deploy-minimal-inference-custom-container.sh
working-directory: cli

Просмотреть файл

@ -38,15 +38,20 @@ path|status|
-|-
[batch-score-rest.sh](batch-score-rest.sh)|[![batch-score-rest](https://github.com/Azure/azureml-examples/workflows/cli-scripts-batch-score-rest/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-batch-score-rest.yml)
[batch-score.sh](batch-score.sh)|[![batch-score](https://github.com/Azure/azureml-examples/workflows/cli-scripts-batch-score/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-batch-score.yml)
[deploy-custom-container-mlflow.sh](deploy-custom-container-mlflow.sh)|[![deploy-custom-container-mlflow](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-mlflow/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-mlflow.yml)
[deploy-custom-container-multimodel-minimal.sh](deploy-custom-container-multimodel-minimal.sh)|[![deploy-custom-container-multimodel-minimal](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-multimodel-minimal/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-multimodel-minimal.yml)
[deploy-custom-container-triton.sh](deploy-custom-container-triton.sh)|[![deploy-custom-container-triton](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-triton/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-triton.yml)
[deploy-custom-container-minimal-multimodel.sh](deploy-custom-container-minimal-multimodel.sh)|[![deploy-custom-container-minimal-multimodel](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-minimal-multimodel/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-minimal-multimodel.yml)
[deploy-custom-container-minimal-single-model.sh](deploy-custom-container-minimal-single-model.sh)|[![deploy-custom-container-minimal-single-model](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-minimal-single-model/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-minimal-single-model.yml)
[deploy-custom-container-mlflow-multideployment-scikit.sh](deploy-custom-container-mlflow-multideployment-scikit.sh)|[![deploy-custom-container-mlflow-multideployment-scikit](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-mlflow-multideployment-scikit/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-mlflow-multideployment-scikit.yml)
[deploy-custom-container-r-multimodel-plumber.sh](deploy-custom-container-r-multimodel-plumber.sh)|[![deploy-custom-container-r-multimodel-plumber](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-r-multimodel-plumber/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-r-multimodel-plumber.yml)
[deploy-custom-container-tfserving-half-plus-two-integrated.sh](deploy-custom-container-tfserving-half-plus-two-integrated.sh)|[![deploy-custom-container-tfserving-half-plus-two-integrated](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two-integrated/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two-integrated.yml)
[deploy-custom-container-tfserving-half-plus-two.sh](deploy-custom-container-tfserving-half-plus-two.sh)|[![deploy-custom-container-tfserving-half-plus-two](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-tfserving-half-plus-two.yml)
[deploy-custom-container-torchserve-densenet.sh](deploy-custom-container-torchserve-densenet.sh)|[![deploy-custom-container-torchserve-densenet](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-torchserve-densenet/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-torchserve-densenet.yml)
[deploy-custom-container-torchserve-huggingface-textgen.sh](deploy-custom-container-torchserve-huggingface-textgen.sh)|[![deploy-custom-container-torchserve-huggingface-textgen](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-torchserve-huggingface-textgen/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-torchserve-huggingface-textgen.yml)
[deploy-custom-container-triton-single-model.sh](deploy-custom-container-triton-single-model.sh)|[![deploy-custom-container-triton-single-model](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-custom-container-triton-single-model/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-custom-container-triton-single-model.yml)
[deploy-local-endpoint.sh](deploy-local-endpoint.sh)|[![deploy-local-endpoint](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-local-endpoint/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-local-endpoint.yml)
[deploy-managed-online-endpoint-access-resource-sai.sh](deploy-managed-online-endpoint-access-resource-sai.sh)|[![deploy-managed-online-endpoint-access-resource-sai](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-managed-online-endpoint-access-resource-sai/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-managed-online-endpoint-access-resource-sai.yml)
[deploy-managed-online-endpoint-access-resource-uai.sh](deploy-managed-online-endpoint-access-resource-uai.sh)|[![deploy-managed-online-endpoint-access-resource-uai](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-managed-online-endpoint-access-resource-uai/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-managed-online-endpoint-access-resource-uai.yml)
[deploy-managed-online-endpoint-mlflow.sh](deploy-managed-online-endpoint-mlflow.sh)|[![deploy-managed-online-endpoint-mlflow](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-managed-online-endpoint-mlflow/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-managed-online-endpoint-mlflow.yml)
[deploy-managed-online-endpoint.sh](deploy-managed-online-endpoint.sh)|[![deploy-managed-online-endpoint](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-managed-online-endpoint/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-managed-online-endpoint.yml)
[deploy-minimal-inference-custom-container.sh](deploy-minimal-inference-custom-container.sh)|[![deploy-minimal-inference-custom-container](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-minimal-inference-custom-container/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-minimal-inference-custom-container.yml)
[deploy-mlcompute-create-with-user-identity.sh](deploy-mlcompute-create-with-user-identity.sh)|[![deploy-mlcompute-create-with-user-identity](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-mlcompute-create-with-user-identity/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-mlcompute-create-with-user-identity.yml)
[deploy-mlcompute-create_with-system-identity.sh](deploy-mlcompute-create_with-system-identity.sh)|[![deploy-mlcompute-create_with-system-identity](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-mlcompute-create_with-system-identity/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-mlcompute-create_with-system-identity.yml)
[deploy-mlcompute-update-to-system-identity.sh](deploy-mlcompute-update-to-system-identity.sh)|[![deploy-mlcompute-update-to-system-identity](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-mlcompute-update-to-system-identity/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-mlcompute-update-to-system-identity.yml)
@ -54,12 +59,9 @@ path|status|
[deploy-moe-autoscale.sh](deploy-moe-autoscale.sh)|[![deploy-moe-autoscale](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-moe-autoscale/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-moe-autoscale.yml)
[deploy-moe-vnet-mlflow.sh](deploy-moe-vnet-mlflow.sh)|[![deploy-moe-vnet-mlflow](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-moe-vnet-mlflow/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-moe-vnet-mlflow.yml)
[deploy-moe-vnet.sh](deploy-moe-vnet.sh)|[![deploy-moe-vnet](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-moe-vnet/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-moe-vnet.yml)
[deploy-r.sh](deploy-r.sh)|[![deploy-r](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-r/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-r.yml)
[deploy-rest.sh](deploy-rest.sh)|[![deploy-rest](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-rest/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-rest.yml)
[deploy-safe-rollout-kubernetes-online-endpoints.sh](deploy-safe-rollout-kubernetes-online-endpoints.sh)|[![deploy-safe-rollout-kubernetes-online-endpoints](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-safe-rollout-kubernetes-online-endpoints/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-safe-rollout-kubernetes-online-endpoints.yml)
[deploy-safe-rollout-online-endpoints.sh](deploy-safe-rollout-online-endpoints.sh)|[![deploy-safe-rollout-online-endpoints](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-safe-rollout-online-endpoints/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-safe-rollout-online-endpoints.yml)
[deploy-tfserving.sh](deploy-tfserving.sh)|[![deploy-tfserving](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-tfserving/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-tfserving.yml)
[deploy-torchserve.sh](deploy-torchserve.sh)|[![deploy-torchserve](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-torchserve/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-torchserve.yml)
[deploy-triton-managed-online-endpoint.sh](deploy-triton-managed-online-endpoint.sh)|[![deploy-triton-managed-online-endpoint](https://github.com/Azure/azureml-examples/workflows/cli-scripts-deploy-triton-managed-online-endpoint/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-deploy-triton-managed-online-endpoint.yml)
[misc.sh](misc.sh)|[![misc](https://github.com/Azure/azureml-examples/workflows/cli-scripts-misc/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-misc.yml)
[mlflow-uri.sh](mlflow-uri.sh)|[![mlflow-uri](https://github.com/Azure/azureml-examples/workflows/cli-scripts-mlflow-uri/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-scripts-mlflow-uri.yml)
@ -72,6 +74,7 @@ path|status|
path|status|description
-|-|-
[jobs/basics/hello-automl/hello-automl-job-basic.yml](jobs/basics/hello-automl/hello-automl-job-basic.yml)|[![jobs/basics/hello-automl/hello-automl-job-basic](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-automl-hello-automl-job-basic/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-automl-hello-automl-job-basic.yml)|A Classification job using bank marketing
[jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline.yml](jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline.yml)|[![jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-single-job-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-single-job-pipeline.yml)|Single job pipeline to train regression model based on nyc taxi dataset
[jobs/single-step/dask/nyctaxi/job.yml](jobs/single-step/dask/nyctaxi/job.yml)|[![jobs/single-step/dask/nyctaxi/job](https://github.com/Azure/azureml-examples/workflows/cli-jobs-single-step-dask-nyctaxi-job/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-single-step-dask-nyctaxi-job.yml)|This sample shows how to run a distributed DASK job on AzureML. The 24GB NYC Taxi dataset is read in CSV format by a 4 node DASK cluster, processed and then written as job output in parquet format.
[jobs/single-step/gpu_perf/gpu_perf_job.yml](jobs/single-step/gpu_perf/gpu_perf_job.yml)|[![jobs/single-step/gpu_perf/gpu_perf_job](https://github.com/Azure/azureml-examples/workflows/cli-jobs-single-step-gpu_perf-gpu_perf_job/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-single-step-gpu_perf-gpu_perf_job.yml)|Runs NCCL-tests on gpu nodes.
[jobs/single-step/julia/iris/job.yml](jobs/single-step/julia/iris/job.yml)|[![jobs/single-step/julia/iris/job](https://github.com/Azure/azureml-examples/workflows/cli-jobs-single-step-julia-iris-job/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-single-step-julia-iris-job.yml)|Train a Flux model on the Iris dataset using the Julia programming language.
@ -164,6 +167,7 @@ path|status|description
[jobs/pipelines-with-components/basics/6c_r_iris/pipeline.yml](jobs/pipelines-with-components/basics/6c_r_iris/pipeline.yml)|[![jobs/pipelines-with-components/basics/6c_r_iris/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-basics-6c_r_iris-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-basics-6c_r_iris-pipeline.yml)|Train an R model on the Iris dataset.
[jobs/pipelines-with-components/image_classification_with_densenet/pipeline.yml](jobs/pipelines-with-components/image_classification_with_densenet/pipeline.yml)|[![jobs/pipelines-with-components/image_classification_with_densenet/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-image_classification_with_densenet-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-image_classification_with_densenet-pipeline.yml)|Train densenet for image classification
[jobs/pipelines-with-components/nyc_taxi_data_regression/pipeline.yml](jobs/pipelines-with-components/nyc_taxi_data_regression/pipeline.yml)|[![jobs/pipelines-with-components/nyc_taxi_data_regression/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-pipeline.yml)|Train regression model based on nyc taxi dataset
[jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline.yml](jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline.yml)|[![jobs/pipelines-with-components/nyc_taxi_data_regression/single-job-pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-single-job-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-nyc_taxi_data_regression-single-job-pipeline.yml)|Single job pipeline to train regression model based on nyc taxi dataset
[jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/pipeline.yml](jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/pipeline.yml)|[![jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-pipeline_with_hyperparameter_sweep-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-pipeline_with_hyperparameter_sweep-pipeline.yml)|Tune hyperparameters using TF component
[jobs/pipelines-with-components/rai_pipeline_adult_analyse/pipeline.yml](jobs/pipelines-with-components/rai_pipeline_adult_analyse/pipeline.yml)|[![jobs/pipelines-with-components/rai_pipeline_adult_analyse/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-rai_pipeline_adult_analyse-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-rai_pipeline_adult_analyse-pipeline.yml)|Sample rai pipeline
[jobs/pipelines-with-components/shakespear_sample_and_word_count_using_spark/pipeline.yml](jobs/pipelines-with-components/shakespear_sample_and_word_count_using_spark/pipeline.yml)|[![jobs/pipelines-with-components/shakespear_sample_and_word_count_using_spark/pipeline](https://github.com/Azure/azureml-examples/workflows/cli-jobs-pipelines-with-components-shakespear_sample_and_word_count_using_spark-pipeline/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-pipelines-with-components-shakespear_sample_and_word_count_using_spark-pipeline.yml)|'submit a pipeline with spark job'
@ -198,6 +202,8 @@ path|status|description
[resources/compute/cluster-minimal.yml](resources/compute/cluster-minimal.yml)|[![resources/compute/cluster-minimal](https://github.com/Azure/azureml-examples/workflows/cli-resources-compute-cluster-minimal/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-resources-compute-cluster-minimal.yml)|*no description*
[resources/compute/cluster-ssh-password.yml](resources/compute/cluster-ssh-password.yml)|[![resources/compute/cluster-ssh-password](https://github.com/Azure/azureml-examples/workflows/cli-resources-compute-cluster-ssh-password/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-resources-compute-cluster-ssh-password.yml)|*no description*
[resources/compute/cluster-system-identity.yml](resources/compute/cluster-system-identity.yml)|[![resources/compute/cluster-system-identity](https://github.com/Azure/azureml-examples/workflows/cli-resources-compute-cluster-system-identity/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-resources-compute-cluster-system-identity.yml)|*no description*
[resources/registry/registry-storage-options.yml](resources/registry/registry-storage-options.yml)|[![resources/registry/registry-storage-options](https://github.com/Azure/azureml-examples/workflows/cli-resources-registry-registry-storage-options/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-resources-registry-registry-storage-options.yml)|Registry with additional configuration for storage accounts
[resources/registry/registry.yml](resources/registry/registry.yml)|[![resources/registry/registry](https://github.com/Azure/azureml-examples/workflows/cli-resources-registry-registry/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-resources-registry-registry.yml)|Basic registry with one primary region and to additional regions
**Assets** ([assets](assets))

Просмотреть файл

@ -1,7 +1,5 @@
set -e
pip install scikit-learn pandas joblib
# <set_variables>
export ENDPOINT_NAME="<ENDPOINT_NAME>"
export ACR_NAME="<CONTAINER_REGISTRY_NAME>"
@ -10,30 +8,28 @@ export ACR_NAME="<CONTAINER_REGISTRY_NAME>"
export ENDPOINT_NAME=endpt-moe-`echo $RANDOM`
export ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
# <setup_build_directory>
export BASE_PATH=endpoints/online/custom-container/multimodel-minimal
mkdir -p $BASE_PATH/{code,build,test-data}
cp "$(dirname $BASE_PATH)/{multimodel-minimal*} $BASE_PATH/"
mv $BASE_PATH/multmodel-minimal.dockerfile $BASE_PATH/build/
mv $BASE_PATH/multmodel-minimal-score.py $BASE_PATH/code/
# </setup_build_directory>
export BASE_PATH=endpoints/online/custom-container/minimal/multimodel
export ASSET_PATH=endpoints/online/custom-container/minimal/multimodel/models
cd $BASE_PATH
# <generate_models_and_test_data>
python multimodel-minimal-train.py
# </generate_models_and_test_data>
cd -
# <build_image>
az acr build -t azureml-examples/minimal-multimodel:1 -r $ACR_NAME -f $BASE_PATH/build/multmodel-minimal.dockerfile $BASE_PATH/build
# </build_image>
# Helper function to change parameters in yaml files
change_vars() {
for FILE in "$@"; do
TMP="${FILE}_"
cp $FILE $TMP
readarray -t VARS < <(cat $TMP | grep -oP '{{.*?}}' | sed -e 's/[}{]//g');
for VAR in "${VARS[@]}"; do
sed -i "s/{{${VAR}}}/${!VAR}/g" $TMP
done
done
}
# <create_endpoint>
az online-endpoint create -n $ENDPOINT_NAME -f $BASE_PATH/multimodel-minimal-endpoint.yml
change_vars $BASE_PATH/minimal-multimodel-endpoint.yml
az ml online-endpoint create -n $ENDPOINT_NAME -f $BASE_PATH/minimal-multimodel-endpoint.yml_
# </create_endpoint>
rm $BASE_PATH/*.yml_
# Check if endpoint was successful
endpoint_status=`az ml online-endpoint show --name $ENDPOINT_NAME --query "provisioning_state" -o tsv`
echo $endpoint_status
@ -45,12 +41,19 @@ else
exit 1
fi
# <build_image>
az acr build -t azureml-examples/minimal-multimodel:1 -r $ACR_NAME -f $BASE_PATH/minimal-multimodel.dockerfile $BASE_PATH
# </build_image>
# <create_deployment>
az online-endpoint create -e $ENDPOINT_NAME -f $BASE_PATH/multimodel-minimal-deployment.yml
change_vars $BASE_PATH/minimal-multimodel-deployment.yml
az ml online-deployment create -e $ENDPOINT_NAME -f $BASE_PATH/minimal-multimodel-deployment.yml_ --all-traffic
az ml online-deployment update -e $ENDPOINT_NAME -f $BASE_PATH/minimal-multimodel-deployment.yml_
# </create_deployment>
# Check if deployment was successful
deploy_status=`az ml online-deployment show --name blue --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv`
deploy_status=`az ml online-deployment show --name minimal-multimodel --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv`
echo $deploy_status
if [[ $deploy_status == "Succeeded" ]]
then
@ -70,8 +73,8 @@ SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -
echo "Scoring url is $SCORING_URL"
# <test_online_endpoints>
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @"$BASE_PATH/test-data/test-data-iris.json" $SCORING_URL
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @"$BASE_PATH/test-data/test-data-diabetes.json" $SCORING_URL
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @"$BASE_PATH/test-data/iris-test-data.json" $SCORING_URL
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @"$BASE_PATH/test-data/diabetes-test-data.json" $SCORING_URL
# </test_online_endpoints>
# <delete_online_endpoint>

Просмотреть файл

@ -0,0 +1,75 @@
#!/bin/bash
set -e
# <set_variables>
export ENDPOINT_NAME="<ENDPOINT_NAME>"
export ACR_NAME="<CONTAINER_REGISTRY_NAME>"
# </set_variables>
export ENDPOINT_NAME=endpt-moe-`echo $RANDOM`
export ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
export BASE_PATH=endpoints/online/custom-container/minimal/single-model
export ASSET_PATH=endpoints/online/model-1
# Helper function to change parameters in yaml files
change_vars() {
for FILE in "$@"; do
TMP="${FILE}_"
cp $FILE $TMP
readarray -t VARS < <(cat $TMP | grep -oP '{{.*?}}' | sed -e 's/[}{]//g');
for VAR in "${VARS[@]}"; do
sed -i "s/{{${VAR}}}/${!VAR}/g" $TMP
done
done
}
# <create_endpoint>
change_vars $BASE_PATH/minimal-single-model-endpoint.yml
az ml online-endpoint create -f $BASE_PATH/minimal-single-model-endpoint.yml_
# </create_endpoint>
rm $BASE_PATH/minimal-single-model-endpoint.yml_
# Get key and url
echo "Getting access key and scoring URL..."
KEY=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query primaryKey -o tsv)
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
# <build_image_pip_in_dockerfile>
az acr build -f $BASE_PATH/pip-in-dockerfile/minimal-single-model-pip-in-dockerfile.dockerfile -t azureml-examples/minimal-single-model-pip-in-dockerfile:1 -r $ACR_NAME $ASSET_PATH
# </build_with_pip_in_dockerfile>
# <create_deployment_pip_in_dockerfile>
DEPLOYMENT_YML=$BASE_PATH/pip-in-dockerfile/minimal-single-model-pip-in-dockerfile-deployment.yml
change_vars $DEPLOYMENT_YML
az ml online-deployment create --endpoint-name $ENDPOINT_NAME -f "${DEPLOYMENT_YML}_" --all-traffic
# </create_deployment_pip_in_dockerfile>
# <test_deployment_pip_in_dockerfile>
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @$ASSET_PATH/sample-request.json $SCORING_URL
# </test_deployment_pip_in_dockerfile>
rm $BASE_PATH/pip-in-dockerfile/*.yml_
# <build_image_conda_in_dockerfile>
az acr build -f $BASE_PATH/conda-in-dockerfile/minimal-single-model-conda-in-dockerfile.dockerfile -t azureml-examples/minimal-single-model-conda-in-dockerfile:1 -r $ACR_NAME $ASSET_PATH
# </build_with_conda_in_dockerfile>
# <create_deployment_conda_in_dockerfile>
DEPLOYMENT_YML=$BASE_PATH/conda-in-dockerfile/minimal-single-model-conda-in-dockerfile-deployment.yml
change_vars $DEPLOYMENT_YML
az ml online-deployment create --endpoint-name $ENDPOINT_NAME -f "${DEPLOYMENT_YML}_" --all-traffic
# </create_deployment_conda_in_dockerfile>
# <test_deployment_conda_in_dockerfile>
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d @$ASSET_PATH/sample-request.json $SCORING_URL
# </test_deployment_conda_in_dockerfile>
rm $BASE_PATH/conda-in-dockerfile/*.yml_
# <delete_online_endpoint>
az ml online-endpoint delete -y -n $ENDPOINT_NAME
# </delete_online_endpoint>

Просмотреть файл

@ -12,7 +12,7 @@ export ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -
# Create subdir "mlflow_context" and set BASE_PATH to it
# <initialize_build_context>
export PARENT_PATH=endpoints/online/custom-container
export PARENT_PATH=endpoints/online/custom-container/mlflow/multideployment-scikit/
export BASE_PATH="$PARENT_PATH/mlflow_context"
export ASSET_PATH=endpoints/online/mlflow
rm -rf $BASE_PATH && mkdir $BASE_PATH
@ -101,6 +101,7 @@ az ml online-endpoint invoke -n $ENDPOINT_NAME --deployment-name sklearn-diabete
az ml online-endpoint invoke -n $ENDPOINT_NAME --deployment-name lightgbm-iris --request-file "$BASE_PATH/sample-request-lightgbm.json"
# </test_online_endpoints_with_invoke>
# <get_endpoint_details>
# Get key
echo "Getting access key..."
KEY=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query primaryKey -o tsv)
@ -109,6 +110,7 @@ KEY=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query primaryKey
echo "Getting scoring url..."
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
# </get_endpoint_details>
# <test_online_endpoints_with_curl>
curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -H "azureml-model-deployment: sklearn-diabetes" -d @"$BASE_PATH/sample-request-sklearn.json" $SCORING_URL
@ -118,5 +120,3 @@ curl -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -H "azu
# <delete_online_endpoint>
az ml online-endpoint delete -y -n $ENDPOINT_NAME
# </delete_online_endpoint>
#rm -rf $BASE_PATH

Просмотреть файл

@ -1,4 +1,8 @@
BASE_PATH=endpoints/online/custom-container/r
#!/bin/bash
set -e
BASE_PATH=endpoints/online/custom-container/r/multimodel-plumber
DEPLOYMENT_NAME=r-deployment
# <set_endpoint_name>
@ -7,7 +11,7 @@ export ENDPOINT_NAME="<YOUR_ENDPOINT_NAME>"
export ENDPOINT_NAME=endpt-r-`echo $RANDOM`
# Get name of workspace ACR, build image
# <get_workspace_details>
WORKSPACE=$(az config get --query "defaults[?name == 'workspace'].value" -o tsv)
ACR_NAME=$(az ml workspace show -n $WORKSPACE --query container_registry -o tsv | cut -d'/' -f9-)
@ -16,47 +20,48 @@ then
echo "Getting ACR name failed, exiting"
exit 1
fi
# </get_workspace_details>
# <build_image>
az acr login -n $ACR_NAME
IMAGE_TAG=${ACR_NAME}.azurecr.io/r_server
az acr build $BASE_PATH -f $BASE_PATH/r.dockerfile -t $IMAGE_TAG -r $ACR_NAME
# </build_image>
# Clean up utility
cleanup(){
sed -i 's/'$ACR_NAME'/{{acr_name}}/' $BASE_PATH/r-deployment.yml
sed -i 's/'$ACR_NAME'/{{ACR_NAME}}/' $BASE_PATH/r-deployment.yml
az ml online-endpoint delete -n $ENDPOINT_NAME -y
az ml model archive -n plumber -v 1
}
# Run image locally for testing
# <run_locally>
docker run --rm -d -p 8000:8000 -v "$PWD/$BASE_PATH/scripts:/var/azureml-app" \
-v "$PWD/$BASE_PATH/models":"/var/azureml-models/models" \
-e AZUREML_MODEL_DIR=/var/azureml-models \
-e AML_APP_ROOT=/var/azureml-app \
-e AZUREML_ENTRY_SCRIPT=plumber.R \
--name="r_server" $IMAGE_TAG
sleep 10
# </run_locally>
# <test_locally>
# Check liveness, readiness, scoring locally
curl "http://localhost:8000/live"
curl "http://localhost:8000/ready"
curl -d @$BASE_PATH/sample_request.json -H 'Content-Type: application/json' http://localhost:8000/score
docker stop r_server
# </test_locally>
# Fill in placeholders in deployment YAML
sed -i 's/{{acr_name}}/'$ACR_NAME'/' $BASE_PATH/r-deployment.yml
sed -i 's/{{ACR_NAME}}/'$ACR_NAME'/' $BASE_PATH/r-deployment.yml
# <create_endpoint>
az ml online-endpoint create --name $ENDPOINT_NAME -f endpoints/online/custom-container/r/r-endpoint.yml
az ml online-endpoint create --name $ENDPOINT_NAME -f $BASE_PATH/r-endpoint.yml
# </create_endpoint>
# <create_deployment>
az ml online-deployment create --name r-deployment --endpoint $ENDPOINT_NAME -f endpoints/online/custom-container/r/r-deployment.yml --all-traffic
# </create_deployment>
# check if create was successful
# <check_endpoint_status>
endpoint_status=`az ml online-endpoint show --name $ENDPOINT_NAME --query "provisioning_state" -o tsv`
echo $endpoint_status
if [[ $endpoint_status == "Succeeded" ]]
@ -66,7 +71,13 @@ else
echo "Endpoint creation failed"
exit 1
fi
# </check_endpoint_status>
# <create_deployment>
az ml online-deployment create --name r-deployment --endpoint $ENDPOINT_NAME -f $BASE_PATH/r-deployment.yml --all-traffic --skip-script-validation
# </create_deployment>
# Check if deployment was successful
deploy_status=`az ml online-deployment show --name r-deployment --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv`
echo $deploy_status
if [[ $deploy_status == "Succeeded" ]]
@ -78,13 +89,14 @@ else
exit 1
fi
# Test remotely
# <test_endpoint>
echo "Testing endpoint"
for model in {a..c}
do
echo "Model $model tested successfully, response was $RESPONSE."
RESPONSE=$(az ml online-endpoint invoke -n $ENDPOINT_NAME --request-file <(jq --arg m "$model" '.model=$m' $BASE_PATH/sample_request.json))
echo "Model $model tested successfully, response was $RESPONSE."
done
# </test_endpoint>
# Clean up
cleanup

Просмотреть файл

@ -0,0 +1,56 @@
#!/bin/bash
set -e
BASE_PATH=endpoints/online/custom-container/tfserving/half-plus-two-integrated
ENDPOINT_NAME=tfsintegrated-`echo $RANDOM`
ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
# Helper function to parameterize YAML
change_vars() {
for FILE in "$@"; do
TMP="${FILE}_"
cp $FILE $TMP
readarray -t VARS < <(cat $TMP | grep -oP '{{.*?}}' | sed -e 's/[}{]//g');
for VAR in "${VARS[@]}"; do
sed -i "s/{{${VAR}}}/${!VAR}/g" $TMP
done
done
}
# <build_image>
az acr login -n $ACR_NAME
az acr build -f $BASE_PATH/half-plus-two-integrated.Dockerfile -t azureml-examples/tfsintegrated:1 -r $ACR_NAME $BASE_PATH
# </build_image>
# <test_locally>
docker run -p 8501:8501 --rm -d --name tfsintegrated -t "$ACR_NAME.azurecr.io/azureml-examples/tfsintegrated:1"
sleep 5
curl -d '{"inputs": [[1,1]]}' -H "Content-Type: application/json" localhost:8501/v1/models/hpt:predict
docker stop tfsintegrated
# </test_locally>
# <create_endpoint>
az ml online-endpoint create -n $ENDPOINT_NAME
# </create_endpoint>
# <create_deployment>
change_vars $BASE_PATH/half-plus-two-integrated-deployment.yml
az ml online-deployment create -f $BASE_PATH/half-plus-two-integrated-deployment.yml_ --all-traffic
rm $BASE_PATH/half-plus-two-integrated-deployment.yml_
# </create_deployment>
# <get_endpoint_details>
KEY=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query primaryKey -o tsv)
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
echo "Key is $KEY"
# </get_endpoint_details>
# <test_deployment>
curl -d @$BASE_PATH/sample-data.json -H "Content-Type: application/json" -H "Authorization: Bearer $KEY" $SCORING_URL
# </test_deployment>
# <delete_online_endpoint>
az ml online-endpoint delete -y -n $ENDPOINT_NAME
# </delete_online_endpoint>

Просмотреть файл

@ -3,7 +3,7 @@
set -e
# <initialize_variables>
BASE_PATH=endpoints/online/custom-container
BASE_PATH=endpoints/online/custom-container/tfserving/half-plus-two
AML_MODEL_NAME=tfserving-mounted
MODEL_NAME=half_plus_two
MODEL_BASE_PATH=/var/azureml-app/azureml-models/$AML_MODEL_NAME/1
@ -49,11 +49,14 @@ export ENDPOINT_NAME="<YOUR_ENDPOINT_NAME>"
export ENDPOINT_NAME=endpt-tfserving-`echo $RANDOM`
# <create_endpoint>
az ml online-endpoint create --name $ENDPOINT_NAME -f endpoints/online/custom-container/tfserving-endpoint.yml
az ml online-endpoint create --name $ENDPOINT_NAME -f $BASE_PATH/tfserving-endpoint.yml
# </create_endpoint>
MODEL_VERSION=$RANDOM
sed -e "s/{{MODEL_VERSION}}/$MODEL_VERSION/g" -i $BASE_PATH/tfserving-deployment.yml
# <create_deployment>
az ml online-deployment create --name tfserving-deployment --endpoint $ENDPOINT_NAME -f endpoints/online/custom-container/tfserving-deployment.yml --all-traffic
az ml online-deployment create --name tfserving-deployment --endpoint $ENDPOINT_NAME -f $BASE_PATH/tfserving-deployment.yml --all-traffic
# </create_deployment>
# <get_status>

Просмотреть файл

@ -2,18 +2,8 @@
set -e
BASE_PATH=endpoints/online/custom-container
AML_MODEL_NAME=torchserve-densenet161
echo $AML_MODEL_NAME
AZUREML_MODEL_DIR=azureml-models/$AML_MODEL_NAME/1
MODEL_BASE_PATH=/var/azureml-app/$AZUREML_MODEL_DIR
BASE_PATH=endpoints/online/custom-container/torchserve/densenet
ENDPOINT_NAME=endpt-torchserve-`echo $RANDOM`
DEPLOYMENT_NAME=torchserve-deployment
# Download model and config file
echo "Downling model and config file..."
mkdir $BASE_PATH/torchserve
wget --progress=dot:mega https://aka.ms/torchserve-densenet161 -O $BASE_PATH/torchserve/densenet161.mar
# Get name of workspace ACR, build image
WORKSPACE=$(az config get --query "defaults[?name == 'workspace'].value" -o tsv)
@ -24,41 +14,51 @@ if [[ $ACR_NAME == "" ]]; then
exit 1
fi
az acr login -n $ACR_NAME
IMAGE_TAG=${ACR_NAME}.azurecr.io/torchserve:8080
az acr build $BASE_PATH/ -f $BASE_PATH/torchserve.dockerfile -t $IMAGE_TAG -r $ACR_NAME
cleanTestingFiles() {
rm -r $BASE_PATH/torchserve
rm $BASE_PATH/kitten_small.jpg
rm $BASE_PATH/torchserve-deployment.yml_
}
# Run image locally for testing
# <download_model>
echo "Downling model and config file..."
mkdir $BASE_PATH/torchserve
wget --progress=dot:mega https://aka.ms/torchserve-densenet161 -O $BASE_PATH/torchserve/densenet161.mar
# </download_model>
# <build_image>
az acr login -n $ACR_NAME
IMAGE_TAG=${ACR_NAME}.azurecr.io/torchserve:1
az acr build -f $BASE_PATH/torchserve.dockerfile -t $IMAGE_TAG -r $ACR_NAME $BASE_PATH
# <build_image>
# <run_image_locally>
docker run --rm -d -p 8080:8080 --name torchserve-test \
-e MODEL_BASE_PATH=$MODEL_BASE_PATH \
-v $PWD/$BASE_PATH/torchserve:$MODEL_BASE_PATH/torchserve $IMAGE_TAG
-e AZUREML_MODEL_DIR=/var/azureml-app/azureml-models/ \
-e TORCHSERVE_MODELS="densenet161=densenet161.mar" \
-v $PWD/$BASE_PATH/torchserve:/var/azureml-app/azureml-models/torchserve $IMAGE_TAG
# </run_image_locally>
sleep 10
cleanTestingFiles() {
rm -r $BASE_PATH/torchserve
rm kitten_small.jpg
}
# Check Torchserve health
# <test_locally>
echo "Checking Torchserve health..."
curl http://localhost:8080/ping
# Download test image
echo "Downloading test image..."
wget https://aka.ms/torchserve-test-image -O kitten_small.jpg
wget https://aka.ms/torchserve-test-image -O $BASE_PATH/kitten_small.jpg
# Check scoring locally
echo "Uploading testing image, the scoring is..."
curl http://localhost:8080/predictions/densenet161 -T kitten_small.jpg
curl http://localhost:8080/predictions/densenet161 -T $BASE_PATH/kitten_small.jpg
docker stop torchserve-test
# </test_locally>
# Deploy model to online endpoint
echo "Deploying the model to a managed online endpoint..."
sed -i 's/{{acr_name}}/'$ACR_NAME'/' $BASE_PATH/$DEPLOYMENT_NAME.yml
# <create_endpoint>
az ml online-endpoint create --name $ENDPOINT_NAME -f $BASE_PATH/torchserve-endpoint.yml
# </create_endpoint>
# <check_endpoint_status>
ENDPOINT_STATUS=$(az ml online-endpoint show --name $ENDPOINT_NAME --query "provisioning_state" -o tsv)
echo "Endpoint status is $ENDPOINT_STATUS"
@ -69,12 +69,16 @@ else
az ml online-endpoint delete --name $ENDPOINT_NAME
exit 1
fi
# </check_endpoint_status>
# Create deployment
echo "Creating deployment..."
az ml online-deployment create --name $DEPLOYMENT_NAME --endpoint $ENDPOINT_NAME --file $BASE_PATH/$DEPLOYMENT_NAME.yml --all-traffic
# <create_deployment>
cp $BASE_PATH/torchserve-deployment.yml $BASE_PATH/torchserve-deployment.yml_
sed -e "s/{{ACR_NAME}}/$ACR_NAME/g" -i $BASE_PATH/torchserve-deployment.yml_
az ml online-deployment create -e $ENDPOINT_NAME -f $BASE_PATH/torchserve-deployment.yml_ --all-traffic
# </create_deployment>
deploy_status=$(az ml online-deployment show --name $DEPLOYMENT_NAME --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv)
# <check_deployment_status>
deploy_status=$(az ml online-deployment show --name torchserve-deployment --endpoint $ENDPOINT_NAME --query "provisioning_state" -o tsv)
echo $deploy_status
if [[ $deploy_status == "Succeeded" ]]; then
echo "Deployment completed successfully"
@ -85,28 +89,27 @@ else
az ml model archive -n $AML_MODEL_NAME --version 1
exit 1
fi
# </check_deployment_status>
# Get accessToken
# <get_endpoint_details>
echo "Getting access token..."
TOKEN=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query accessToken -o tsv)
# Get scoring url
echo "Getting scoring url..."
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
# </get_endpoint_details>
# Check scoring
# <test_endpoint>
echo "Uploading testing image, the scoring is..."
curl -H "Authorization: {Bearer $TOKEN}" -T kitten_small.jpg $SCORING_URL
curl -H "Authorization: {Bearer $TOKEN}" -T $BASE_PATH/kitten_small.jpg $SCORING_URL
# </test_endpoint>
echo "Tested successfully, cleaning up"
cleanTestingFiles
# Delete endpoint
# <delete_endpoint>
echo "Deleting endpoint..."
az ml online-endpoint delete -n $ENDPOINT_NAME --yes
# </delete_endpoint>
# Delete model
echo "Deleting model..."
az ml model archive -n $AML_MODEL_NAME --version 1

Просмотреть файл

@ -0,0 +1,123 @@
#!/bin/bash
set -e
# <set_parameters>
ENDPOINT_NAME=hf-tg-`echo $RANDOM`
IMAGE_TAG=azureml-examples/huggingface-textgen:1
BASE_PATH=endpoints/online/custom-container/torchserve/huggingface-textgen
SERVE_PATH=$BASE_PATH/serve/examples/Huggingface_Transformers
ROOT_PATH=$PWD
ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
# </set_parameters>
# <define_helper_functions>
# Helper function to parameterize YAML
change_vars() {
for FILE in "$@"; do
TMP="${FILE}_"
cp $FILE $TMP
readarray -t VARS < <(cat $TMP | grep -oP '{{.*?}}' | sed -e 's/[}{]//g');
for VAR in "${VARS[@]}"; do
sed -i "s#{{${VAR}}}#${!VAR}#g" $TMP
done
done
}
cleanup () {
sudo rm -rf $BASE_PATH/serve || true
rm $BASE_PATH/ts-hf-tg-deployment.yml_
az ml online-endpoint delete -y -n $ENDPOINT_NAME
}
# </define_helper_functions>
# <build_image>
az acr login -n $ACR_NAME
az acr build -t $IMAGE_TAG -f $BASE_PATH/ts-hf-tg.dockerfile -r $ACR_NAME $BASE_PATH
# </build_image>
# <download_huggingface_assets>
cd $BASE_PATH
rm -rf serve
git init serve
cd serve
git remote add -f origin https://github.com/pytorch/serve
git config core.sparseCheckout true
echo "examples/Huggingface_Transformers" >> .git/info/sparse-checkout
git pull origin master
cd $ROOT_PATH
# </download_huggingface_assets>
# <generate_model>
if [[ ! -f $SERVE_PATH/setup_config.json_ ]]; then
cp $BASE_PATH/ts-hf-tg-setup_config.json $SERVE_PATH/setup_config.json_
fi
cp $BASE_PATH/ts-hf-tg-setup_config.json $SERVE_PATH/setup_config.json
chmod -R o+w $SERVE_PATH
cd $SERVE_PATH
docker run --rm -v $PWD:/tmp/wd:z -w /tmp/wd -t "$ACR_NAME.azurecr.io/$IMAGE_TAG" "python Download_Transformer_models.py; \
sed -i 's#\"max_length\": 50#\"max_length\": 300#g' ./Transformer_model/config.json; \
torch-model-archiver --model-name Textgeneration --version 1.0 --serialized-file Transformer_model/pytorch_model.bin --handler ./Transformer_handler_generalized.py --extra-files Transformer_model/config.json,./setup_config.json; \
exit;"
cp setup_config.json_ setup_config.json
rm setup_config.json_
cd $ROOT_PATH
# </generate_model>
# <test_locally>
docker run --name huggingface-textgen --rm -d -p 8080:8080 -v "$PWD/$SERVE_PATH":/tmp/wd -e AZUREML_MODEL_DIR=/tmp/wd -e TORCHSERVE_MODELS="textgeneration=Textgeneration.mar" -t "$ACR_NAME.azurecr.io/$IMAGE_TAG"
sleep 30
curl -X POST http://127.0.0.1:8080/predictions/textgeneration -T "$SERVE_PATH/Text_gen_artifacts/sample_text.txt"
docker stop huggingface-textgen
# </test_locally>
# <create_endpoint>
az ml online-endpoint create -n $ENDPOINT_NAME
# </create_endpoint>
# <check_endpoint_status>
endpoint_status=`az ml online-endpoint show --name $ENDPOINT_NAME --query "provisioning_state" -o tsv`
echo $endpoint_status
if [[ $endpoint_status == "Succeeded" ]]
then
echo "Endpoint created successfully"
else
echo "Endpoint creation failed"
exit 1
fi
# </check_endpoint_status>
# <create_deployment>
change_vars $BASE_PATH/ts-hf-tg-deployment.yml
az ml online-deployment create -f $BASE_PATH/ts-hf-tg-deployment.yml_ --all-traffic
# </create_deployment>
# <check_deployment_status>
deploy_status=`az ml online-deployment show --endpoint-name $ENDPOINT_NAME --name textgeneration --query "provisioning_state" -o tsv`
echo $deploy_status
if [[ $deploy_status == "Succeeded" ]]
then
echo "Deployment completed successfully"
else
echo "Deployment failed"
exit 1
fi
# </check_deployment_status>
# <get_endpoint_details>
# Get key
echo "Getting access key..."
KEY=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query primaryKey -o tsv)
# Get scoring url
echo "Getting scoring url..."
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
# </get_endpoint_details>
# <test_endpoint>
curl -X POST -H "Authorization: Bearer $KEY" -T "$SERVE_PATH/Text_gen_artifacts/sample_text.txt" $SCORING_URL
# </test_endpoint>
cleanup

Просмотреть файл

@ -13,7 +13,7 @@ export ENDPOINT_NAME=endpt-moe-`echo $RANDOM`
export ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
# <set_base_path_and_copy_assets>
export PARENT_PATH="endpoints/online/custom-container"
export PARENT_PATH="endpoints/online/custom-container/triton/single-model"
export ASSET_PATH="endpoints/online/triton/single-model"
export BASE_PATH="$PARENT_PATH/triton_context"
rm -rf $BASE_PATH && mkdir -p $BASE_PATH/models
@ -68,5 +68,3 @@ python endpoints/online/triton/single-model/triton_densenet_scoring.py --base_ur
# <delete_online_endpoint>
az ml online-endpoint delete -y -n $ENDPOINT_NAME
# </delete_online_endpoint>
#rm -rf $BASE_PATH

Просмотреть файл

@ -1,87 +0,0 @@
#!/bin/bash
set -e
# <set_variables>
export ENDPOINT_NAME="<ENDPOINT_NAME>"
export ACR_NAME="<CONTAINER_REGISTRY_NAME>"
# </set_variables>
export ENDPOINT_NAME=endpt-moe-`echo $RANDOM`
export ACR_NAME=$(az ml workspace show --query container_registry -o tsv | cut -d'/' -f9-)
# <set_base_path_and_copy_model>
export PARENT_PATH="endpoints/online/custom-container"
export BASE_PATH="$PARENT_PATH/minimal_context"
rm -rf $BASE_PATH && mkdir -p $BASE_PATH
cp -r endpoints/online/model-1 $BASE_PATH
cp $PARENT_PATH/minimal.dockerfile $BASE_PATH/Dockerfile
cp $PARENT_PATH/minimal-deployment.yml $BASE_PATH/deployment.yaml
cp $PARENT_PATH/minimal-endpoint.yml $BASE_PATH/endpoint.yaml
sed -i "s/{{acr_name}}/$ACR_NAME/g;\
s/{{endpoint_name}}/$ENDPOINT_NAME/g;" $BASE_PATH/deployment.yaml
sed -i "s/{{endpoint_name}}/$ENDPOINT_NAME/g;" $BASE_PATH/endpoint.yaml
# </set_base_path_and_copy_model>
# <build_image_locally>
docker build -t azureml-examples/minimal-inf-cc $BASE_PATH
# </build_image_locally>
# <run_image_locally>
docker run -d -p 5001:5001 -v "$(pwd)/$BASE_PATH/model-1/onlinescoring":/var/azureml-app -v "$(pwd)/$BASE_PATH/model-1/model":/var/azureml-app/azureml-models/model -e AZUREML_APP_ROOT=/var/azureml-app -e AZUREML_ENTRY_SCRIPT=score.py -e AZUREML_MODEL_DIR=/var/azureml-app/azureml-models -t azureml-examples/minimal-inf-cc:latest
# </run_image_locally>
sleep 10
# <test_local_image>
curl -X POST -H "Content-Type: application/json" -d @$BASE_PATH/model-1/sample-request.json localhost:5001/score
# </test_local_image>
# <login_to_acr>
az acr login -n $ACR_NAME
# </login_to_acr>
# We can either push the image to ACR
# <tag_image>
docker tag azureml-examples/minimal-inf-cc "$ACR_NAME.azurecr.io/azureml-examples/minimal-inf-cc:latest"
# </tag_image>
# <push_to_acr>
docker push "$ACR_NAME.azurecr.io/azureml-examples/minimal-inf-cc:latest"
# </push_to_acr>
# Or build with ACR directly
# <build_with_acr>
az acr build -t azureml-examples/minimal-inf-cc:latest -r $ACR_NAME $BASE_PATH
# </build_with_acr>
# <create_endpoint>
az ml online-endpoint create -f $BASE_PATH/endpoint.yaml
# </create_endpoint>
# <create_deployment>
az ml online-deployment create --endpoint-name $ENDPOINT_NAME -f $BASE_PATH/deployment.yaml --all-traffic
# </create_deployment>
# <test_online_endpoint_with_invoke>
az ml online-endpoint invoke -n $ENDPOINT_NAME --request-file "$BASE_PATH/model-1/sample-request.json"
# </test_online_endpoint_with_invoke>
# Get accessToken
echo "Getting access token..."
TOKEN=$(az ml online-endpoint get-credentials -n $ENDPOINT_NAME --query accessToken -o tsv)
# Get scoring url
echo "Getting scoring url..."
SCORING_URL=$(az ml online-endpoint show -n $ENDPOINT_NAME --query scoring_uri -o tsv)
echo "Scoring url is $SCORING_URL"
# <test_online_endpoint_with_curl>
curl -H "Authorization: {Bearer $TOKEN}" -H "Content-Type: application/json" -d @$BASE_PATH/model-1/sample-request.json $SCORING_URL
# </test_online_endpoint_with_curl>
# <delete_online_endpoint>
az ml online-endpoint delete -y -n $ENDPOINT_NAME
# </delete_online_endpoint>
#rm -rf $BASE_PATH

Просмотреть файл

@ -1 +0,0 @@
asset-file-contents

Просмотреть файл

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2016, The TensorFlow Serving Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,24 @@
import joblib
import os
import pandas as pd
from pathlib import Path
import json
models = None
def init():
global models
model_dir = Path(os.getenv("AZUREML_MODEL_DIR")) / "models"
models = {m[:-4]: joblib.load(model_dir / m) for m in os.listdir(model_dir)}
def run(data):
data = json.loads(data)
model = models[data["model"]]
payload = pd.DataFrame(data["data"])
try:
ret = model.predict(payload)
return pd.DataFrame(ret).to_json()
except KeyError:
raise KeyError("No such model")

Просмотреть файл

@ -0,0 +1,31 @@
# Deploy multiple models to one deployment
This example shows how to deploy multiple models to a single deployment by extending the AzureML Inference Minimal CPU image.
It can be run end-to-end by executing the `deploy-custom-container-minimal-multimodel.sh` script in the CLI directory.
## Build the image
The image used for this example is defined in the `minimal-multimodel.dockerfile` and uses the pip method of adding additional requirements needed to score the model. To add requirements to an AzureML Inference base image using conda, see the `deploy-custom-container-minimal-single-model` example, which demonstrates both methods.
## Models
The two models used in this example are included in the `models` subdirectory. They are both sklearn models and need the same requirements. The two models are registered as a single "registered model" on Azure by including them in the same directory and passing that directory as the `path` of the model. In this example, the model is defined inline in the deployment.
## Score script
The score script for this example is located in the `code` directory.
At deployment time, both models are loaded into memory using the standard method of using the `AZUREML_MODEL_DIR` environment variable. Even though this is a custom container deployment, the `AZUREML_MODEL_DIR` is still present in the container. This happens any time a model is mounted to an endpoint container, even if the custom container does not use an Azure image as a base image.
The models are loaded into a dictionary keyed on their names. When a request is received, the desired model is retrieved from the JSON payload, and the relevant model is used to score the payload.
## Environment
The environment is defined in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy. Both models share the same environment.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.
### Python requirements
Both models are loaded in the same process by the same Python interpreter. Models loaded in a multi-model deployment using this technique must share the same Python version and - even if they do not have the same dependencies in a strict sense (i.e. a scikit model loaded alongside a torch model) - their dependiences must not conflict with each other and be able to be simultaneously imported.

Просмотреть файл

@ -0,0 +1,14 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: minimal-multimodel
endpoint_name: {{ENDPOINT_NAME}}
model:
name: minimal-multimodel
path: models
code_configuration:
code: code
scoring_script: minimal-multimodel-score.py
environment:
name: minimal-multimodel
image: {{ACR_NAME}}.azurecr.io/azureml-examples/minimal-multimodel:1
instance_type: Standard_DS2_v2
instance_count: 1

Просмотреть файл

@ -1,3 +1,3 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineEndpoint.schema.json
name: multimodel-minimal
name: {{ENDPOINT_NAME}}
auth_mode: key

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1 @@
{"model": "diabetes", "data": {"age": {"0": -0.0018820165277906047, "1": 0.03081082953138418, "2": -0.0018820165277906047, "3": -0.027309785684926546, "4": -0.005514554978810025}, "sex": {"0": 0.05068011873981862, "1": 0.05068011873981862, "2": -0.044641636506989144, "3": -0.044641636506989144, "4": 0.05068011873981862}, "bmi": {"0": -0.02452875939178067, "1": 0.0563071461492793, "2": -0.06656343027313188, "3": 0.08864150836570328, "4": -0.015906262800734303}, "bp": {"0": 0.052858044296680055, "1": 0.07695800112762488, "2": 0.0012152796589411327, "3": -0.02519138732582271, "4": -0.06764173985804409}, "s1": {"0": 0.027326050202012293, "1": 0.04934129593323023, "2": -0.0029449126784123676, "3": 0.02182223876920781, "4": 0.04934129593323023}, "s2": {"0": 0.03000096875273476, "1": -0.012274073588852453, "2": 0.003070201038834776, "3": 0.04252690722431616, "4": 0.07916527725369175}, "s3": {"0": 0.030231910429713918, "1": -0.036037570043851025, "2": 0.01182372140927921, "3": -0.03235593223976409, "4": -0.028674294435677143}, "s4": {"0": -0.002592261998183278, "1": 0.07120997975363674, "2": -0.002592261998183278, "3": 0.03430885887772673, "4": 0.03430885887772673}, "s5": {"0": -0.021395309255276825, "1": 0.12005149644350945, "2": -0.020292321339471356, "3": 0.002861309289833047, "4": -0.018113692315690322}, "s6": {"0": 0.036201264733044136, "1": 0.09004865462589207, "2": -0.025930338989472702, "3": 0.07762233388138869, "4": 0.044485478562713045}}}

Просмотреть файл

@ -0,0 +1 @@
{"model": "iris", "data": {"sepal length (cm)": {"0": 5.8, "1": 6.1, "2": 6.8, "3": 7.1, "4": 4.5}, "sepal width (cm)": {"0": 2.7, "1": 3.0, "2": 3.0, "3": 3.0, "4": 2.3}, "petal length (cm)": {"0": 5.1, "1": 4.9, "2": 5.5, "3": 5.9, "4": 1.3}, "petal width (cm)": {"0": 1.9, "1": 1.8, "2": 2.1, "3": 2.1, "4": 0.3}}}

Просмотреть файл

@ -0,0 +1,24 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: conda-in-dockerfile
endpoint_name: {{ENDPOINT_NAME}}
model:
name: minimal-cc-model
path: ../../../../model-1/model
code_configuration:
code: ../../../../model-1/onlinescoring
scoring_script: score.py
environment:
name: conda-in-dockerfile
image: {{ACR_NAME}}.azurecr.io/azureml-examples/minimal-single-model-conda-in-dockerfile:1
inference_config:
liveness_route:
path: /
port: 5001
readiness_route:
path: /
port: 5001
scoring_route:
path: /score
port: 5001
instance_type: Standard_DS2_v2
instance_count: 1

Просмотреть файл

@ -1,7 +1,5 @@
FROM mcr.microsoft.com/azureml/minimal-ubuntu20.04-py38-cpu-inference:latest
ARG MODEL_NAME=model-1
USER dockeruser
# Conda is already installed
@ -12,7 +10,7 @@ ENV CONDA_ENV_DIR=/opt/miniconda/envs
# or can be added alongside the image in the environment yaml definition for Azure to build
# Create a new conda environment and install the same version of the server
COPY $MODEL_NAME/environment/conda.yml /tmp/conda.yaml
COPY ./environment/conda.yml /tmp/conda.yaml
RUN conda env create -n userenv -f /tmp/conda.yaml && \
export SERVER_VERSION=$(pip show azureml-inference-server-http | grep Version | sed -e 's/.*: //') && \
$CONDA_ENV_DIR/userenv/bin/pip install azureml-inference-server-http==$SERVER_VERSION

Просмотреть файл

@ -0,0 +1,31 @@
# Deploy a minimal custom container
This example shows how to deploy a simple custom container endpoint by extending the AzureML Inference Server minimal cpu image in two different ways - via a conda file or via pip requirements.
It can be run end-to-end by executing the `deploy-minimal-inference-custom-container.sh` script in the CLI directory.
## Build the image(s)
The subdirectories `conda-in-dockerfile` and `pip-in-dockerfile` correspond to two different techniques for adding custom Python requirements at build time to the AzureML Inference base image. Requirements can also be added at deployment time via pip or conda through environment variables. Alternatively, environments can be defined on Azure as a combination of an inference base image and a conda file. In this case, Azure will manage the actual build.
### Using pip
Adding pip requirements to a Dockerfile can be accomplished through a simple `pip install` statement as in `minimal-single-model-pip-in-dockerfile.dockerfile` or via a `requirements.txt` file copied in during the build process. No additional environment variables are needed.
### Conda
The file `minimal-single-model-conda-in-dockerfile.dockerfile` in the `conda-in-dockerfile` directory shows how to add a new conda environment to the minimal inferencence base image. The inference image uses a conda environment called `amlenv`, however in this example we create a new conda environment called `userenv`, reinstall the `azureml-inference-server-http` package and then modify three environment variables `AZUREML_CONDA_ENVIRONMENT`, `PATH` and `LD_LIBRARY_PATH` to make our conda environment take precedence. The conda file used for this image is located at `endpoints/online/model-1/environment`.
## Model
Both deployments uses the `model-1` sklearn model located at `endpoints/online/model-1/model` as well as the sample request located in the parent directory. It is defined inline in the deployment yaml and mounted at deployment time.
## Score script
The scoring script for this model is located at `endpoints/online/model-1/onlinescoring` and is identitcal to the scoring script for this model that would be used in a non-custom container scenario.
Even though this deployment uses a custom container, the `AZUREML_MODEL_DIR` environment variable is still present in the container, and so the model init process that uses it is the same as well.
## Environment
The environment is defined inline in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.

Просмотреть файл

@ -0,0 +1,3 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineEndpoint.schema.json
name: {{ENDPOINT_NAME}}
auth_mode: key

Просмотреть файл

@ -0,0 +1,16 @@
# Deploy a minimal custom container
This example shows how to deploy a simple custom container endpoint by extending the AzureML Inference Server minimal cpu image.
This example can be run end-to-end by executing the deploy-minimal-inference-custom-container.sh script in the CLI directory.
### Build the image
Minimal.dockerfile in this directory shows how to add a new conda environment to the minimal inferencence base image. The inference image uses a conda environment called `amlenv`, however in this example we create a new conda environment called `userenv`, reinstall the `azureml-inference-server-http` package and then modify three environment variables `AZUREML_CONDA_ENVIRONMENT`, `PATH` and `LD_LIBRARY_PATH` to make our conda environment take precedence.
Dependencies can also be added to the image through pip using a `requirements.txt` file without the need to modify environment variables.
### Run the image locally
Containers using the AzureML inference images can be run locally by mounting the code and model directories to their expected locations. The inference images find the directories via the environment variables `AML_APP_ROOT` for the code directory and `AZUREML_MODEL_DIR` for the model directory. The default locations for thse are /var/azureml-app and /var/azureml-app/azureml-model.
### Add the image to ACR
The locally built image can either be added to ACR through pushing the locally-built image or delegating the build to ACR.

Просмотреть файл

@ -1,15 +1,15 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: blue
endpoint_name: {{endpoint_name}}
name: pip-in-dockerfile
endpoint_name: {{ENDPOINT_NAME}}
model:
name: minimal-cc-model
path: ./model-1/model
path: ../../../../model-1/model
code_configuration:
code: ./model-1/onlinescoring
code: ../../../../model-1/onlinescoring
scoring_script: score.py
environment:
name: minimal-inf-cc-env
image: {{acr_name}}.azurecr.io/azureml-examples/minimal-inf-cc:latest
name: pip-in-dockerfile
image: {{ACR_NAME}}.azurecr.io/azureml-examples/minimal-single-model-pip-in-dockerfile:1
inference_config:
liveness_route:
path: /

Просмотреть файл

@ -0,0 +1,3 @@
FROM mcr.microsoft.com/azureml/minimal-ubuntu20.04-py38-cpu-inference:latest
RUN pip install numpy pip scikit-learn scipy joblib

Просмотреть файл

@ -0,0 +1,24 @@
# Deploy a custom container using MLFlow
This example shows how to deploy two MLFlow models that each have different conda environments using a custom container. In this example, we deploy the MLFlow models to two separate deployments (as opposed to one single deployment) to accommodate their different requirements needs. For a non-MLFlow single-deployment multimodel example, see the `deploy-custom-containerminimal-multimodel` example.
This example can be run end-to-end by executing the deploy-custom-container-mlflow.sh script in the CLI directory.
## Build the images
The custom container is defined in the `mlflow.dockerfile` in this directory. The container uses the AzureML minimal inference image as its base image and creates a new conda environment from a conda yaml. For more details on adding conda environments to the AzureML minimal inference images, see the `deploy-custom-container-minimal` example.
Each of the two models has different conda requirements, so we build the image twice. A build argument `MLFLOW_MODEL_NAME` enables us to choose which conda yaml we want to use for our newly-created `userenv` environment.
Images can be built with ACR using the `az acr build` command.
## Environment
The environment is defined inline in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.
## Deployment
We create a separate deployment for each model behind the same endpoint using the two containers. Each model has a deployment yaml that registers a separate model and environment.
## Testing the model
Traffic can be routed to a specific deployment using the header `azureml-model-deployment` or the `--deployment-name` flag of the `az ml online-endpoint invoke` CLI command.

Просмотреть файл

@ -1,14 +0,0 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: multimodel-minimal
endpoint_name: multimodel-minimal
model:
name: multimodel-minimal
path: models
code_configuration:
code: code
scoring_script: multimodel-minimal-score.py
environment:
name: multimodel-minimal
image: ACR_NAME.azurecr.io/azureml-examples/minimal-multimodel:1
instance_type: Standard_DS2_v2
instance_count: 1

Просмотреть файл

@ -1,24 +0,0 @@
import joblib
import os
import pandas as pd
from pathlib import Path
def init():
global model_iris
global model_diabetes
model_dir = Path(os.getenv("AZUREML_MODEL_DIR"))
model_iris = joblib.load(model_dir / "iris.sav")
model_diabetes = joblib.load(model_dir / "diabetes.sav")
def run(data):
model = data["model"]
data = pd.DataFrame(data["data"])
if model == "iris":
return model_iris.predict(data)
elif model == "diabetes":
return model_diabetes.predict(data)
else:
return "No such model"

Просмотреть файл

@ -1,36 +0,0 @@
import sklearn.datasets
from sklearn import linear_model
from sklearn.model_selection import train_test_split
import joblib
from pathlib import Path
import json
test_size = 0.3
model_dir = Path("models")
test_data_dir = Path("test-data")
datasets = {
"diabetes": sklearn.datasets.load_diabetes(as_frame=True).frame,
"iris": sklearn.datasets.load_iris(as_frame=True).frame,
}
def train_model(name, dataset, test_size=0.3):
ycol = "target"
Xcol = [c for c in dataset.columns if c != ycol]
X = dataset[Xcol]
y = dataset[ycol]
Xtrain, Xtest, ytrain, ytest = train_test_split(X, y, test_size=test_size)
Xtest = Xtest.reset_index(drop=True)
model = linear_model.Lasso(alpha=0.1)
model.fit(Xtrain, ytrain)
joblib.dump(model, filename=model_dir / f"{name}.sav")
with open(test_data_dir / f"{name}-test-data.json", "w") as f:
test_data = {}
test_data["model"] = name
test_data["data"] = Xtest.loc[0:4, :].to_dict()
f.write(json.dumps(test_data))
for name, dataset in datasets.items():
train_model(name, dataset)

Просмотреть файл

@ -11,7 +11,7 @@ model:
environment:
#name: r-environment
#version: 1
image: {{acr_name}}.azurecr.io/r_server
image: {{ACR_NAME}}.azurecr.io/r_server
inference_config:
liveness_route:
port: 8000

Просмотреть файл

@ -0,0 +1,34 @@
# Deploy an integrated inference container
This example shows how to deploy a fully-integrated inference BYOC image using TFServing with the model integrated into the container itself and both `model` and `code` absent from the deployment yaml.
## How to deploy
To deploy this example execute the deploy-custom-container-half-plus-two-integrated.sh script in the CLI directory.
## Testing
The endpoint can be tested using the code at the end of the deployment script:
```bash
curl -d @sample-data.json -H "Content-Type: application/json" -H "Authorization: Bearer $KEY" $SCORING_URL
```
The inputs are a list of tensors of dimension 2.
```json
{
"inputs" : [
[[1,2,3,4]],
[[0,1,1,1]]
]
}
```
## Model
This model is a simple [Half Plus Two](https://www.tensorflow.org/tfx/serving/docker) model which returns `2X+0.5` for input tensors of dimension 2.
```python
class HPT(tf.Module):
@tf.function(input_signature=[tf.TensorSpec(shape=[None,None], dtype=tf.float32)])
def __call__(self, x):
return tf.math.add(tf.math.multiply(x, 0.5),2)
```
## Image
This is a BYOC TFServing image with the model integrated into the container itself.

Просмотреть файл

@ -0,0 +1,17 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: integratedbyoc
endpoint_name: {{ENDPOINT_NAME}}
environment:
image: {{ACR_NAME}}.azurecr.io/azureml-examples/tfsintegrated:1
inference_config:
liveness_route:
port: 8501
path: /v1/models/hpt
readiness_route:
port: 8501
path: /v1/models/hpt
scoring_route:
port: 8501
path: /v1/models/hpt:predict
instance_type: Standard_DS2_v2
instance_count: 1

Просмотреть файл

@ -0,0 +1,5 @@
FROM docker.io/tensorflow/serving:latest
ENV MODEL_NAME=hpt
COPY models /models

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,6 @@
{
"inputs" : [
[[1,2,3,4]],
[[0,1,1,1]]
]
}

Просмотреть файл

@ -0,0 +1,17 @@
# Deploy the Half Plus Two model using TFServing
In this example, we deploy a single model (half-plus-two) using a TFServing custom container.
This example can be run end-to-end by executing the `deploy-custom-container-tfserving-half-plus-two.sh` script in the `CLI` directory.
## Model
This example uses the `half-plus-two` model, which is downloaded in the script. In the deployment yaml it is registered as a model and mounted at runtime at the `AZUREML_MODEL_DIR` environment variable as in standard deployments. The default location for model mounting is `/var/azureml-app/azureml-models/<MODEL_NAME>/<MODEL_VERSION>` unless overridden by the `model_mount_path` field in the deployment yaml.
This path is passed to TFServing as an environment variable in the deployment YAML.
## Build the image
This example uses the `tensorflow/serving` image with no modifications as defined in the `tfserving.dockerfile`. Although this example demonstrates the usual workflow of building the image on an ACR instance, this deployment could bypass the ACR build step and include the `docker.io` path of the image as the image URL in the deployment YAML.
## Environment
The environment is defined inline in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.

Просмотреть файл

@ -3,10 +3,10 @@ name: tfserving-deployment
endpoint_name: tfserving-endpoint
model:
name: tfserving-mounted
version: 1
version: {{MODEL_VERSION}}
path: ./half_plus_two
environment_variables:
MODEL_BASE_PATH: /var/azureml-app/azureml-models/tfserving-mounted/1
MODEL_BASE_PATH: /var/azureml-app/azureml-models/tfserving-mounted/{{MODEL_VERSION}}
MODEL_NAME: half_plus_two
environment:
#name: tfserving

Просмотреть файл

@ -1,3 +0,0 @@
FROM pytorch/torchserve:latest-cpu
CMD ["torchserve","--start","--model-store","$MODEL_BASE_PATH/torchserve","--models","densenet161=densenet161.mar"]

Просмотреть файл

@ -0,0 +1,16 @@
# Deploy a Torchserve custom container using the Densenet model
In this example, we deploy a single model (Densenet) using a Torchserve custom container.
This example can be run end-to-end by executing the `deploy-custom-container-torchserve-densenet.sh` script in the `CLI` directory.
## Model
This example uses the `densenet161` model. It is registered as a model ahead-of-time using a separate call to `az ml model create`. Upon instantiation, the `AZUREML_MODEL_DIR` environment variable as in standard deployments. The default location for model mounting is `/var/azureml-app/azureml-models/<MODEL_NAME>/<MODEL_VERSION>` unless overridden by the `model_mount_path` field in the deployment yaml.
This path is passed to TFServing as an environment variable in the deployment YAML.
## Environment
The environment is defined inline in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.

Просмотреть файл

@ -1,13 +1,12 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: torchserve-deployment
endpoint_name: torchserve-endpoint
model: azureml:torchserve-densenet161:1
model:
path: torchserve
environment_variables:
MODEL_BASE_PATH: /var/azureml-app/azureml-models/torchserve-densenet161/1
TORCHSERVE_MODELS: "densenet161=densenet161.mar"
environment:
#name: torchserve-environment
#version: 1
image: {{acr_name}}.azurecr.io/torchserve:8080
image: {{ACR_NAME}}.azurecr.io/torchserve:1
inference_config:
liveness_route:
port: 8080

Просмотреть файл

@ -0,0 +1,3 @@
FROM pytorch/torchserve:latest-cpu
CMD ["torchserve","--start","--model-store","$AZUREML_MODEL_DIR/torchserve","--models","$TORCHSERVE_MODELS"]

Просмотреть файл

@ -0,0 +1,24 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: textgeneration
endpoint_name: {{ENDPOINT_NAME}}
model:
name: hf-tg
path: serve/examples/Huggingface_Transformers/Textgeneration.mar
environment_variables:
TORCHSERVE_MODELS: "textgeneration=Textgeneration.mar"
environment:
name: hf-tg
image: {{ACR_NAME}}.azurecr.io/{{IMAGE_TAG}}
inference_config:
liveness_route:
port: 8080
path: /ping
readiness_route:
port: 8080
path: /ping
scoring_route:
port: 8080
path: /predictions/textgeneration
instance_type: Standard_DS2_v2
instance_count: 1

Просмотреть файл

@ -0,0 +1,12 @@
{
"model_name":"gpt2",
"mode":"text_generation",
"do_lower_case":true,
"num_labels":"0",
"save_mode":"pretrained",
"max_length":"20",
"captum_explanation":false,
"FasterTransformer":false,
"embedding_name": "gpt2",
"model_parallel":false
}

Просмотреть файл

@ -0,0 +1,5 @@
FROM pytorch/torchserve:latest-cpu
RUN pip install transformers==4.6.0
CMD ["torchserve","--start","--model-store","$AZUREML_MODEL_DIR","--models","$TORCHSERVE_MODELS","--ncs"]

Просмотреть файл

@ -0,0 +1,16 @@
# Deploy a Triton model using a custom container.
In this example, we deploy a single model (Densenet) using a Torchserve custom container.
This example can be run end-to-end by executing the `deploy-custom-container-triton-single-model.sh` script in the `CLI` directory.
## Model
This example uses the `densenet161` model. The default location for model mounting is `/var/azureml-app/azureml-models/<MODEL_NAME>/<MODEL_VERSION>` unless overridden by the `model_mount_path` field in the deployment yaml. a
This path is passed to Triton as an environment variable in the deployment YAML and passed to Triton using the customized CMD command from the Dockerfile.
## Environment
The environment is defined inline in the deployment yaml and references the ACR url of the image. The ACR must be associated with the workspace (or have a user-assigned managed identity that enables ACRPull) in order to successfully deploy.
The environment also contains an `inference_config` block that defines the `liveness`, `readiness`, and `scoring` routes by path and port. Because the images used in this examples are based on the AzureML Inference Minimal images, these values are the same as those in a non-BYOC deployment, however they must be included since we are now using a custom image.

Просмотреть файл

@ -1,7 +1,7 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: triton-cc-deployment
endpoint_name: {{endpoint_name}}
model:
model:
path: ./models/model_1
model_mount_path: /models
environment: