Skip to content

Commit

Permalink
MMD OD/IS sdk, cli examples; Update HuggingFace Classification exampl…
Browse files Browse the repository at this point in the history
…es (#2477)

* MMD OD/IS sdk, cli examples; Update HuggingFace Classification examples

* update examples

* instance segmentation infer notebooks

* typo

* update mmd docs

* CLI inference examples for OD and IS

* example updates; resolving review comments

* update compute name; dataets version

* update compute name

* update remove image_min_size and image_max_size from OD and IS

* Using yolof_r50_c5_8x8_1x_coco in OD example notebook

* update reistry for inference

---------

Co-authored-by: grajguru <[email protected]>
  • Loading branch information
rjaincc and grajguru authored Aug 3, 2023
1 parent a739ecf commit 8fd0b93
Show file tree
Hide file tree
Showing 54 changed files with 13,119 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ experiment_name: AzureML-Train-Finetune-Vision-MultiClass-Samples
inputs:
# # model - specify the foundation model available in the azureml system registry
mlflow_model_path:
path: azureml://registries/azureml-preview/models/google-vit-base-patch16-224/versions/1
path: azureml://registries/azureml-staging/models/google-vit-base-patch16-224/versions/1
type: mlflow_model
# model_name: microsoft/beit-base-patch16-224-pt22k-ft22k
# dataset files
Expand All @@ -22,7 +22,7 @@ inputs:
type: uri_file
# compute
compute_model_import: sample-model-import-cluster
compute_finetune: sample-finetune-cluster-gpu-nc6
compute_finetune: sample-finetune-cluster-gpu

outputs:
# map the output of the fine tuning job to the output of pipeline job so that we can easily register the fine tuned model
Expand All @@ -32,12 +32,12 @@ outputs:

settings:
force_rerun: true
default_compute: azureml:sample-finetune-cluster-gpu-nc6
default_compute: azureml:sample-finetune-cluster-gpu

jobs:
huggingface_transformers_model_finetune_job:
type: pipeline
component: azureml://registries/azureml-preview/components/image_classification_pipeline/labels/latest
component: azureml://registries/azureml-staging/components/image_classification_pipeline/labels/latest
inputs:

# Compute
Expand All @@ -57,7 +57,6 @@ jobs:
training_data: ${{parent.inputs.training_data}}
validation_data: ${{parent.inputs.validation_data}}

auto_hyperparameter_selection: False
image_width: -1
image_height: -1
metric_for_best_model: accuracy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
set -x

# script inputs
registry_name="azureml-preview"
registry_name="azureml-staging"
subscription_id="<SUBSCRIPTION_ID>"
resource_group_name="<RESOURCE_GROUP>"
workspace_name="<WORKSPACE_NAME>"

compute_cluster_model_import="sample-model-import-cluster"
compute_cluster_finetune="sample-finetune-cluster-gpu-nc6"
compute_cluster_finetune="sample-finetune-cluster-gpu"
# if above compute cluster does not exist, create it with the following vm size
compute_model_import_sku="Standard_D12"
compute_finetune_sku="Standard_NC6"
compute_finetune_sku="STANDARD_NC6s_v3"
# This is the number of GPUs in a single node of the selected 'vm_size' compute.
# Setting this to less than the number of GPUs will result in underutilized GPUs, taking longer to train.
# Setting this to more than the number of GPUs will result in an error.
Expand All @@ -38,12 +38,12 @@ huggingface_sample_request_data="./huggingface_sample_request_data.json"
# finetuning job parameters
finetuning_pipeline_component="transformers_image_classification_pipeline"
# Training settings
number_of_gpu_to_use_finetuning=$gpus_per_node # set to the number of GPUs available in the compute
process_count_per_instance=$gpus_per_node # set to the number of GPUs available in the compute

# 1. Install dependencies
pip install azure-ai-ml==1.8.0
pip install azure-identity==1.13.0
pip install datasets==2.3.2
pip install datasets==2.12.0

unameOut=$(uname -a)
case "${unameOut}" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ For using this component, run the shell script file `bash ./hftransformers-fridg
Currently following models are supported:
| Model Name | Source |
| ------ | ---------- |
| [microsoft-beit-base-patch16-224-pt22k-ft22k](https://ml.azure.com/registries/azureml-preview/models/microsoft-beit-base-patch16-224-pt22k-ft22k/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [microsoft-swinv2-base-patch4-window12-192-22k](https://ml.azure.com/registries/azureml-preview/models/microsoft-swinv2-base-patch4-window12-192-22k/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [facebook-deit-base-patch16-224](https://ml.azure.com/registries/azureml-preview/models/facebook-deit-base-patch16-224/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [google-vit-base-patch16-224](https://ml.azure.com/registries/azureml-preview/models/google-vit-base-patch16-224/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [Image classification models from Huggingface](https://huggingface.co/models?pipeline_tag=image-classification&sort=downloads) | HuggingFace |
| [microsoft-beit-base-patch16-224-pt22k-ft22k](https://ml.azure.com/registries/azureml-staging/models/microsoft-beit-base-patch16-224-pt22k-ft22k/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [microsoft-swinv2-base-patch4-window12-192-22k](https://ml.azure.com/registries/azureml-staging/models/microsoft-swinv2-base-patch4-window12-192-22k/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [facebook-deit-base-patch16-224](https://ml.azure.com/registries/azureml-staging/models/facebook-deit-base-patch16-224/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [google-vit-base-patch16-224](https://ml.azure.com/registries/azureml-staging/models/google-vit-base-patch16-224/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [Image classification models from Huggingface's Transformer library](https://huggingface.co/models?pipeline_tag=image-classification&library=transformers)| HuggingFace |
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ experiment_name: AzureML-Train-Finetune-Vision-MultiLabel-Samples
inputs:
# # model - specify the foundation model available in the azureml system registry
mlflow_model_path:
path: azureml://registries/azureml-preview/models/google-vit-base-patch16-224/versions/1
path: azureml://registries/azureml-staging/models/google-vit-base-patch16-224/versions/1
type: mlflow_model
# model_name: microsoft/beit-base-patch16-224-pt22k-ft22k
# dataset files
Expand All @@ -22,7 +22,7 @@ inputs:
type: uri_file
# compute
compute_model_import: sample-model-import-cluster
compute_finetune: sample-finetune-cluster-gpu-nc6
compute_finetune: sample-finetune-cluster-gpu


outputs:
Expand All @@ -33,12 +33,12 @@ outputs:

settings:
force_rerun: true
default_compute: azureml:sample-finetune-cluster-gpu-nc6
default_compute: azureml:sample-finetune-cluster-gpu

jobs:
huggingface_transformers_model_finetune_job:
type: pipeline
component: azureml://registries/azureml-preview/components/image_classification_pipeline/labels/latest
component: azureml://registries/azureml-staging/components/image_classification_pipeline/labels/latest
inputs:

# Compute
Expand All @@ -58,7 +58,6 @@ jobs:
training_data: ${{parent.inputs.training_data}}
validation_data: ${{parent.inputs.validation_data}}

auto_hyperparameter_selection: False
image_width: -1
image_height: -1
metric_for_best_model: iou
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
set -x

# script inputs
registry_name="azureml-preview"
registry_name="azureml-staging"
subscription_id="<SUBSCRIPTION_ID>"
resource_group_name="<RESOURCE_GROUP>"
workspace_name="<WORKSPACE_NAME>"

compute_cluster_model_import="sample-model-import-cluster"
compute_cluster_finetune="sample-finetune-cluster-gpu-nc6"
compute_cluster_finetune="sample-finetune-cluster-gpu"
# if above compute cluster does not exist, create it with the following vm size
compute_model_import_sku="Standard_D12"
compute_finetune_sku="Standard_NC6"
compute_finetune_sku="STANDARD_NC6s_v3"
# This is the number of GPUs in a single node of the selected 'vm_size' compute.
# Setting this to less than the number of GPUs will result in underutilized GPUs, taking longer to train.
# Setting this to more than the number of GPUs will result in an error.
Expand All @@ -38,12 +38,12 @@ huggingface_sample_request_data="./huggingface_sample_request_data.json"
# finetuning job parameters
finetuning_pipeline_component="transformers_image_classification_pipeline"
# Training settings
number_of_gpu_to_use_finetuning=$gpus_per_node # set to the number of GPUs available in the compute
process_count_per_instance=$gpus_per_node # set to the number of GPUs available in the compute

# 1. Install dependencies
pip install azure-ai-ml==1.8.0
pip install azure-identity==1.13.0
pip install datasets==2.3.2
pip install datasets==2.12.0

unameOut=$(uname -a)
case "${unameOut}" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ For using this component, run the shell script file `bash ./hftransformers-fridg
Currently following models are supported:
| Model Name | Source |
| ------ | ---------- |
| [microsoft-beit-base-patch16-224-pt22k-ft22k](https://ml.azure.com/registries/azureml-preview/models/microsoft-beit-base-patch16-224-pt22k-ft22k/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [microsoft-swinv2-base-patch4-window12-192-22k](https://ml.azure.com/registries/azureml-preview/models/microsoft-swinv2-base-patch4-window12-192-22k/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [facebook-deit-base-patch16-224](https://ml.azure.com/registries/azureml-preview/models/facebook-deit-base-patch16-224/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [google-vit-base-patch16-224](https://ml.azure.com/registries/azureml-preview/models/google-vit-base-patch16-224/version/1?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-preview registry |
| [Image classification models from Huggingface](https://huggingface.co/models?pipeline_tag=image-classification&sort=downloads) | HuggingFace |
| [microsoft-beit-base-patch16-224-pt22k-ft22k](https://ml.azure.com/registries/azureml-staging/models/microsoft-beit-base-patch16-224-pt22k-ft22k/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [microsoft-swinv2-base-patch4-window12-192-22k](https://ml.azure.com/registries/azureml-staging/models/microsoft-swinv2-base-patch4-window12-192-22k/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [facebook-deit-base-patch16-224](https://ml.azure.com/registries/azureml-staging/models/facebook-deit-base-patch16-224/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [google-vit-base-patch16-224](https://ml.azure.com/registries/azureml-staging/models/google-vit-base-patch16-224/version/3?tid=72f988bf-86f1-41af-91ab-2d7cd011db47#overview) | azureml-staging registry |
| [Image classification models from Huggingface's Transformer library](https://huggingface.co/models?pipeline_tag=image-classification&library=transformers)| HuggingFace |
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"fp16": {
"enabled": true,
"loss_scale": 0,
"loss_scale_window": 1000,
"hysteresis": 2,
"min_loss_scale": 1
},
"zero_optimization": {
"stage": 1,
"allgather_partitions": true,
"allgather_bucket_size": 200000000,
"overlap_comm": true,
"reduce_scatter": true,
"reduce_bucket_size": 200000000,
"contiguous_gradients": false,
"cpu_offload": false
},
"zero_allow_untested_optimizer": true,
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"scheduler": {
"type": "WarmupLR",
"params": {
"warmup_min_lr": "auto",
"warmup_max_lr": "auto",
"warmup_num_steps": "auto"
}
},
"steps_per_print": 2000,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"gradient_accumulation_steps": "auto",
"wall_clock_breakdown": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: demo
instance_type: Standard_DS3_v2
instance_count: 1
Loading

0 comments on commit 8fd0b93

Please sign in to comment.