Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image notebook/cli param update #2435

Merged
merged 24 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
# Compute
compute_model_import: ${{parent.inputs.compute_model_import}}
compute_finetune: ${{parent.inputs.compute_finetune}}
number_of_gpu_to_use_finetuning: 1
num_nodes_finetune: 1
process_count_per_instance: 1
MadhuM02 marked this conversation as resolved.
Show resolved Hide resolved
instance_count: 1

# model
task_name: image-classification
Expand All @@ -57,10 +57,12 @@ jobs:
training_data: ${{parent.inputs.training_data}}
validation_data: ${{parent.inputs.validation_data}}

image_width: 224
image_height: 224
number_of_workers: 8
auto_hyperparameter_selection: False
image_width: -1
image_height: -1
metric_for_best_model: accuracy
apply_augmentations: True
number_of_workers: 8
apply_deepspeed: False
deepspeed_config: ${{parent.inputs.ds_finetune}}
apply_ort: False
Expand All @@ -74,9 +76,9 @@ jobs:
warmup_steps: 0
optimizer: adamw_hf
weight_decay: 0.0
extra_optim_args: ""
gradient_accumulation_step: 1
precision: 32
metric_for_best_model: accuracy
label_smoothing_factor: 0.0
random_seed: 42
evaluation_strategy: epoch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
# Compute
compute_model_import: ${{parent.inputs.compute_model_import}}
compute_finetune: ${{parent.inputs.compute_finetune}}
number_of_gpu_to_use_finetuning: 1
num_nodes_finetune: 1
process_count_per_instance: 1
instance_count: 1

# model
task_name: image-classification-multilabel
Expand All @@ -58,10 +58,12 @@ jobs:
training_data: ${{parent.inputs.training_data}}
validation_data: ${{parent.inputs.validation_data}}

image_width: 224
image_height: 224
number_of_workers: 8
auto_hyperparameter_selection: False
rjaincc marked this conversation as resolved.
Show resolved Hide resolved
image_width: -1
image_height: -1
metric_for_best_model: iou
apply_augmentations: True
number_of_workers: 8
apply_deepspeed: False
deepspeed_config: ${{parent.inputs.ds_finetune}}
apply_ort: False
Expand All @@ -75,9 +77,9 @@ jobs:
warmup_steps: 0
optimizer: adamw_hf
weight_decay: 0.0
extra_optim_args: ""
gradient_accumulation_step: 1
precision: 32
metric_for_best_model: accuracy
label_smoothing_factor: 0.0
random_seed: 42
evaluation_strategy: epoch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"metadata": {},
"outputs": [],
"source": [
"! pip install azure-ai-ml==1.0.0\n",
"! pip install azure-ai-ml --upgrade\n",
"! pip install azure-identity\n",
"! pip install datasets==2.3.2"
]
Expand Down Expand Up @@ -505,13 +505,14 @@
" # model_selection_args\n",
" \"model_family\": \"HuggingFaceImage\",\n",
" # # specify the model_name instead of mlflow_model if you want to use a model from the huggingface hub\n",
" \"mlflow_model\": foundation_model,\n",
" # \"model_name\": huggingface_model_name,\n",
" # \"mlflow_model\": foundation_model,\n",
MadhuM02 marked this conversation as resolved.
Show resolved Hide resolved
" \"model_name\": huggingface_model_name,\n",
" # finetune_args\n",
" \"auto_hyperparameter_selection\": False,\n",
" \"image_width\": 224,\n",
" \"image_height\": 224,\n",
" \"image_width\": -1,\n",
" \"image_height\": -1,\n",
" \"task_name\": \"image-classification\",\n",
" \"metric_for_best_model\": \"accuracy\",\n",
" \"apply_augmentations\": True,\n",
" \"number_of_workers\": 8,\n",
" \"apply_deepspeed\": False,\n",
Expand All @@ -527,9 +528,9 @@
" \"warmup_steps\": 0,\n",
" \"optimizer\": \"adamw_hf\",\n",
" \"weight_decay\": 0.0,\n",
" \"extra_optim_args\": \"\",\n",
" \"gradient_accumulation_step\": 1,\n",
" \"precision\": \"32\",\n",
" \"metric_for_best_model\": \"accuracy\",\n",
" \"label_smoothing_factor\": 0.0,\n",
" \"random_seed\": 42,\n",
" \"evaluation_strategy\": \"epoch\",\n",
Expand All @@ -545,8 +546,8 @@
" \"resume_from_checkpoint\": False,\n",
" \"save_as_mlflow_model\": True,\n",
"}\n",
"number_of_gpu_to_use_finetuning = 1\n",
"num_nodes_finetune = 1\n",
"process_count_per_instance = 1\n",
"instance_count = 1\n",
"\n",
"# Ensure that the user provides only one of mlflow_model or model_name\n",
"if pipeline_component_args.get(\"mlflow_model\") is None and pipeline_component_args.get(\"model_name\") is None:\n",
Expand Down Expand Up @@ -593,8 +594,8 @@
" compute_finetune=finetune_cluster_name,\n",
" training_data=Input(type=AssetTypes.MLTABLE, path=training_mltable_path),\n",
" validation_data=Input(type=AssetTypes.MLTABLE, path=validation_mltable_path),\n",
" number_of_gpu_to_use_finetuning=number_of_gpu_to_use_finetuning,\n",
" num_nodes_finetune=num_nodes_finetune,\n",
" instance_count=instance_count,\n",
" process_count_per_instance=process_count_per_instance,\n",
" **pipeline_component_args,\n",
" )\n",
" return {\n",
Expand Down Expand Up @@ -875,14 +876,14 @@
" success_threshold=1,\n",
" timeout=10,\n",
" period=10,\n",
" initial_delay=10,\n",
" initial_delay=2000,\n",
" ),\n",
" readiness_probe=ProbeSettings(\n",
" failure_threshold=10,\n",
" success_threshold=1,\n",
" timeout=10,\n",
" period=10,\n",
" initial_delay=10,\n",
" initial_delay=2000,\n",
" ),\n",
")\n",
"workspace_ml_client.online_deployments.begin_create_or_update(demo_deployment).wait()\n",
Expand Down Expand Up @@ -938,8 +939,9 @@
" return f.read()\n",
"\n",
"request_json = {\n",
" \"inputs\": {\n",
" \"image\": [base64.encodebytes(read_image(sample_image)).decode(\"utf-8\")],\n",
" \"input_data\": {\n",
" \"columns\": [\"image\"],\n",
" \"data\": [base64.encodebytes(read_image(sample_image)).decode(\"utf-8\")],\n",
" }\n",
"}\n",
"\n",
Expand Down Expand Up @@ -997,8 +999,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "vision_finetune",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"metadata": {},
"outputs": [],
"source": [
"! pip install azure-ai-ml==1.0.0\n",
"! pip install azure-ai-ml --upgrade\n",
"! pip install azure-identity\n",
"! pip install datasets==2.3.2"
]
Expand Down Expand Up @@ -97,9 +97,10 @@
" subscription_id = \"SUBSCRIPTION_ID\"\n",
" resource_group = \"RESOURCE_GROUP\"\n",
" workspace_name = \"AML_WORKSPACE_NAME\"\n",
" workspace_ml_client = MLClient(\n",
" credential, subscription_id, resource_group, workspace_name\n",
" )\n",
"\n",
"workspace_ml_client = MLClient(\n",
" credential, subscription_id, resource_group, workspace_name\n",
")\n",
"\n",
"registry_ml_client = MLClient(\n",
" credential,\n",
Expand Down Expand Up @@ -503,13 +504,14 @@
" # model_selection_args\n",
" \"model_family\": \"HuggingFaceImage\",\n",
" # # specify the model_name instead of mlflow_model if you want to use a model from the huggingface hub\n",
" \"mlflow_model\": foundation_model,\n",
" # \"model_name\": huggingface_model_name,\n",
" # \"mlflow_model\": foundation_model,\n",
MadhuM02 marked this conversation as resolved.
Show resolved Hide resolved
" \"model_name\": huggingface_model_name,\n",
" # finetune_args\n",
" \"auto_hyperparameter_selection\": False,\n",
" \"image_width\": 224,\n",
" \"image_height\": 224,\n",
" \"image_width\": -1,\n",
" \"image_height\": -1,\n",
" \"task_name\": \"image-classification-multilabel\",\n",
" \"metric_for_best_model\": \"iou\",\n",
" \"apply_augmentations\": True,\n",
" \"number_of_workers\": 8,\n",
" \"apply_deepspeed\": False,\n",
Expand All @@ -525,9 +527,9 @@
" \"warmup_steps\": 0,\n",
" \"optimizer\": \"adamw_hf\",\n",
" \"weight_decay\": 0.0,\n",
" \"extra_optim_args\": \"\",\n",
" \"gradient_accumulation_step\": 1,\n",
" \"precision\": \"32\",\n",
" \"metric_for_best_model\": \"accuracy\",\n",
" \"label_smoothing_factor\": 0.0,\n",
" \"random_seed\": 42,\n",
" \"evaluation_strategy\": \"epoch\",\n",
Expand All @@ -543,8 +545,8 @@
" \"resume_from_checkpoint\": False,\n",
" \"save_as_mlflow_model\": True,\n",
"}\n",
"number_of_gpu_to_use_finetuning = 1\n",
"num_nodes_finetune = 1\n",
"process_count_per_instance = 1\n",
"instance_count = 1\n",
"\n",
"# Ensure that the user provides only one of mlflow_model or model_name\n",
"if pipeline_component_args.get(\"mlflow_model\") is None and pipeline_component_args.get(\"model_name\") is None:\n",
Expand Down Expand Up @@ -591,8 +593,8 @@
" compute_finetune=finetune_cluster_name,\n",
" training_data=Input(type=AssetTypes.MLTABLE, path=training_mltable_path),\n",
" validation_data=Input(type=AssetTypes.MLTABLE, path=validation_mltable_path),\n",
" number_of_gpu_to_use_finetuning=number_of_gpu_to_use_finetuning,\n",
" num_nodes_finetune=num_nodes_finetune,\n",
" instance_count=instance_count,\n",
" process_count_per_instance=process_count_per_instance,\n",
" **pipeline_component_args,\n",
" )\n",
" return {\n",
Expand Down Expand Up @@ -930,8 +932,9 @@
" return f.read()\n",
"\n",
"request_json = {\n",
" \"inputs\": {\n",
" \"image\": [base64.encodebytes(read_image(sample_image)).decode(\"utf-8\")],\n",
" \"input_data\": {\n",
" \"columns\": [\"image\"],\n",
" \"data\": [base64.encodebytes(read_image(sample_image)).decode(\"utf-8\")],\n",
" }\n",
"}\n",
"\n",
Expand Down Expand Up @@ -989,8 +992,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "vision_finetune",
MadhuM02 marked this conversation as resolved.
Show resolved Hide resolved
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
}
},
"nbformat": 4,
Expand Down