Skip to content

Commit

Permalink
updated model example structure (#1909)
Browse files Browse the repository at this point in the history
* updated model example structure

* remove on needed file reference

* updated path

* added updated workflows

* Update README.md
  • Loading branch information
AbeOmor committed Dec 5, 2022
1 parent a833543 commit ec9ae58
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 38 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/cli-jobs-basics-hello-model-as-input.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: cli-jobs-basics-hello-model-as-input
on:
workflow_dispatch:
schedule:
- cron: "0 0/8 * * *"
pull_request:
branches:
- main
paths:
- cli/jobs/basics/**
- infra/**
- .github/workflows/cli-jobs-basics-hello-model-as-input.yml
- cli/setup.sh
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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.AZUREML_CREDENTIALS}}
- name: bootstrap resources
run: |
echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
bash bootstrap.sh
working-directory: infra
continue-on-error: false
- name: setup-cli
run: |
source "${{ github.workspace }}/infra/sdk_helpers.sh";
source "${{ github.workspace }}/infra/init_environment.sh";
bash setup.sh
working-directory: cli
continue-on-error: true
- name: run job
run: |
source "${{ github.workspace }}/infra/sdk_helpers.sh";
source "${{ github.workspace }}/infra/init_environment.sh";
bash -x ../../run-job.sh hello-model-as-input.yml
working-directory: cli/jobs/basics
50 changes: 50 additions & 0 deletions .github/workflows/cli-jobs-basics-hello-model-as-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: cli-jobs-basics-hello-model-as-output
on:
workflow_dispatch:
schedule:
- cron: "0 0/8 * * *"
pull_request:
branches:
- main
paths:
- cli/jobs/basics/**
- infra/**
- .github/workflows/cli-jobs-basics-hello-model-as-output.yml
- cli/setup.sh
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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.AZUREML_CREDENTIALS}}
- name: bootstrap resources
run: |
echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
bash bootstrap.sh
working-directory: infra
continue-on-error: false
- name: setup-cli
run: |
source "${{ github.workspace }}/infra/sdk_helpers.sh";
source "${{ github.workspace }}/infra/init_environment.sh";
bash setup.sh
working-directory: cli
continue-on-error: true
- name: run job
run: |
source "${{ github.workspace }}/infra/sdk_helpers.sh";
source "${{ github.workspace }}/infra/init_environment.sh";
bash -x ../../run-job.sh hello-model-as-output.yml
working-directory: cli/jobs/basics
2 changes: 2 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ path|status|description
[jobs/basics/hello-iris-folder.yml](jobs/basics/hello-iris-folder.yml)|[![jobs/basics/hello-iris-folder](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-iris-folder/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-iris-folder.yml)|*no description*
[jobs/basics/hello-iris-literal.yml](jobs/basics/hello-iris-literal.yml)|[![jobs/basics/hello-iris-literal](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-iris-literal/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-iris-literal.yml)|*no description*
[jobs/basics/hello-mlflow.yml](jobs/basics/hello-mlflow.yml)|[![jobs/basics/hello-mlflow](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-mlflow/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-mlflow.yml)|*no description*
[jobs/basics/hello-model-as-input.yml](jobs/basics/hello-model-as-input.yml)|[![jobs/basics/hello-model-as-input](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-model-as-input/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-model-as-input.yml)|*no description*
[jobs/basics/hello-model-as-output.yml](jobs/basics/hello-model-as-output.yml)|[![jobs/basics/hello-model-as-output](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-model-as-output/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-model-as-output.yml)|*no description*
[jobs/basics/hello-notebook.yml](jobs/basics/hello-notebook.yml)|[![jobs/basics/hello-notebook](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-notebook/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-notebook.yml)|*no description*
[jobs/basics/hello-pipeline-abc.yml](jobs/basics/hello-pipeline-abc.yml)|[![jobs/basics/hello-pipeline-abc](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-pipeline-abc/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-pipeline-abc.yml)|*no description*
[jobs/basics/hello-pipeline-customize-output-file.yml](jobs/basics/hello-pipeline-customize-output-file.yml)|[![jobs/basics/hello-pipeline-customize-output-file](https://github.com/Azure/azureml-examples/workflows/cli-jobs-basics-hello-pipeline-customize-output-file/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/cli-jobs-basics-hello-pipeline-customize-output-file.yml)|*no description*
Expand Down
8 changes: 1 addition & 7 deletions cli/assets/model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ This repository contains example `YAML` files for creating `model` using Azure M

- Sample `YAML` files for creating a `model` asset by uploading local file.
- Sample `YAML` files for creating a `model` asset by uploading MLflow folder.
- Sample `YAML` files for using a `model` asset as an input and output in a Job
- Sample `YAML` files for using a `model` asset as an input and output in a job.

- To create a model asset using any of the sample `YAML` files provided in this directory, execute following command:
```cli
> az ml model create -f <file-name>.yml
```


- To create a job that uses a `model` asset using any of the sample `YAML` files provided in this directory, execute following command:
```cli
> az ml job create -f <job-name>.yml
```

To learn more about Azure Machine Learning CLI 2.0, [follow this link](https://docs.microsoft.com/azure/machine-learning/how-to-configure-cli).
31 changes: 0 additions & 31 deletions cli/assets/model/src/load_score.py

This file was deleted.

16 changes: 16 additions & 0 deletions cli/jobs/basics/hello-model-as-input.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json

# Possible Paths for models:
# AzureML Datastore: azureml://datastores/<datastore-name>/paths/<path_on_datastore>
# MLflow run: runs:/<run-id>/<path-to-model-relative-to-the-root-of-the-artifact-location>
# Job: azureml://jobs/<job-name>/outputs/<output-name>/paths/<path-to-model-relative-to-the-named-output-location>
# Model Asset: azureml:<my_model>:<version>

command: |
ls ${{inputs.my_model}}
inputs:
my_model:
type: mlflow_model # List of all model types here: https://learn.microsoft.com/azure/machine-learning/reference-yaml-model#yaml-syntax
path: ../../assets/model/mlflow-model
environment: azureml:AzureML-sklearn-1.0-ubuntu20.04-py38-cpu@latest
compute: azureml:cpu-cluster
23 changes: 23 additions & 0 deletions cli/jobs/basics/hello-model-as-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json

# Possible Paths for Model:
# Local path: mlflow-model/model.pkl
# AzureML Datastore: azureml://datastores/<datastore-name>/paths/<path_on_datastore>
# MLflow run: runs:/<run-id>/<path-to-model-relative-to-the-root-of-the-artifact-location>
# Job: azureml://jobs/<job-name>/outputs/<output-name>/paths/<path-to-model-relative-to-the-named-output-location>
# Model Asset: azureml:<my_model>:<version>

code: src
command: >-
python hello-model-as-output.py
--input_model ${{inputs.input_model}}
--custom_model_output ${{outputs.output_folder}}
inputs:
input_model:
type: mlflow_model # mlflow_model,custom_model, triton_model
path: ../../assets/model/mlflow-model
outputs:
output_folder:
type: custom_model # mlflow_model,custom_model, triton_model
environment: azureml:AzureML-sklearn-1.0-ubuntu20.04-py38-cpu@latest
compute: azureml:cpu-cluster
File renamed without changes.

0 comments on commit ec9ae58

Please sign in to comment.