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

Add support for MMD models in import model pipeline #3597

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
@@ -1,7 +1,7 @@
$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json

name: convert_model_to_mlflow
version: 0.0.33
version: 0.0.34
type: command

is_deterministic: True
Expand All @@ -19,7 +19,7 @@ command: |
pip_pkg_str="${pip_pkgs[*]}"
if [[ -n "$pip_pkg_str" ]]; then echo "Installing $pip_pkg_str"; pip install $pip_pkg_str; echo "pip installation completed. For any installation error please check above logs"; fi;
echo "Running model conversion ... "
python -u run_model_preprocess.py $[[--model-id ${{inputs.model_id}}]] $[[--task-name ${{inputs.task_name}}]] $[[--model-download-metadata ${{inputs.model_download_metadata}}]] $[[--license-file-path ${{inputs.license_file_path}}]] $[[--hf-config-args "${{inputs.hf_config_args}}"]] $[[--hf-tokenizer-args "${{inputs.hf_tokenizer_args}}"]] $[[--hf-model-args "${{inputs.hf_model_args}}"]] $[[--hf-pipeline-args "${{inputs.hf_pipeline_args}}"]] $[[--hf-config-class ${{inputs.hf_config_class}}]] $[[--hf-model-class ${{inputs.hf_model_class}}]] $[[--hf-tokenizer-class ${{inputs.hf_tokenizer_class}}]] $[[--hf-use-experimental-features ${{inputs.hf_use_experimental_features}}]] $[[--extra-pip-requirements "${{inputs.extra_pip_requirements}}"]] $[[--inference-base-image "${{inputs.inference_base_image}}"]] --vllm-enabled ${{inputs.vllm_enabled}} --model-framework ${{inputs.model_framework}} --model-path ${{inputs.model_path}} --mlflow-model-output-dir ${{outputs.mlflow_model_folder}} --model-flavor ${{inputs.model_flavor}}
python -u run_model_preprocess.py $[[--model-id ${{inputs.model_id}}]] $[[--task-name ${{inputs.task_name}}]] $[[--model-download-metadata ${{inputs.model_download_metadata}}]] $[[--license-file-path ${{inputs.license_file_path}}]] $[[--hf-config-args "${{inputs.hf_config_args}}"]] $[[--hf-tokenizer-args "${{inputs.hf_tokenizer_args}}"]] $[[--hf-model-args "${{inputs.hf_model_args}}"]] $[[--hf-pipeline-args "${{inputs.hf_pipeline_args}}"]] $[[--hf-config-class ${{inputs.hf_config_class}}]] $[[--hf-model-class ${{inputs.hf_model_class}}]] $[[--hf-tokenizer-class ${{inputs.hf_tokenizer_class}}]] $[[--hf-use-experimental-features ${{inputs.hf_use_experimental_features}}]] $[[--extra-pip-requirements "${{inputs.extra_pip_requirements}}"]] $[[--inference-base-image "${{inputs.inference_base_image}}"]] --vllm-enabled ${{inputs.vllm_enabled}} --model-framework ${{inputs.model_framework}} $[[--model-path "${{inputs.model_path}}"]] $[[--model-path-mmd "${{inputs.model_path_mmd}}"]] --mlflow-model-output-dir ${{outputs.mlflow_model_folder}} --model-flavor ${{inputs.model_flavor}}
echo "Completed model conversion ... "

inputs:
Expand Down Expand Up @@ -156,7 +156,13 @@ inputs:
type: uri_folder
description: Path to the model.
mode: ro_mount
optional: false
optional: true

model_path_mmd:
type: uri_folder
description: Path to the MMD model.
mode: ro_mount
optional: true

license_file_path:
type: uri_file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type: pipeline
name: import_model
display_name: Import model
description: Import a model into a workspace or a registry
version: 0.0.39
version: 0.0.40

# Pipeline inputs
inputs:
Expand Down Expand Up @@ -270,8 +270,23 @@ jobs:
model_output:
type: uri_folder

mmdetection_image_objectdetection_instancesegmentation_model_import:
component: azureml:mmdetection_image_objectdetection_instancesegmentation_model_import/versions/0.0.19
compute: ${{parent.inputs.compute}}
resources:
instance_type: '${{parent.inputs.instance_type}}'
identity:
type: user_identity
inputs:
model_family: 'MmDetectionImage'
model_name: ${{parent.inputs.model_id}}
download_from_source: False
outputs:
output_dir:
type: uri_file

convert_model_to_mlflow:
component: azureml:convert_model_to_mlflow:0.0.33
component: azureml:convert_model_to_mlflow:0.0.34
compute: ${{parent.inputs.compute}}
resources:
instance_type: '${{parent.inputs.instance_type}}'
Expand All @@ -284,6 +299,7 @@ jobs:
license_file_path: ${{parent.inputs.license_file_path}}
model_framework: ${{parent.inputs.model_framework}}
model_download_metadata: ${{parent.jobs.download_model.outputs.model_download_metadata}}
model_path_mmd: ${{parent.jobs.mmdetection_image_objectdetection_instancesegmentation_model_import.outputs.output_dir}}
model_path: ${{parent.jobs.download_model.outputs.model_output}}
hf_config_args: ${{parent.inputs.hf_config_args}}
hf_tokenizer_args: ${{parent.inputs.hf_tokenizer_args}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def _get_parser():
required=False,
help="Model download details",
)
parser.add_argument("--model-path", type=Path, required=True, help="Model input path")
parser.add_argument("--model-path", type=Path, required=False, help="Model input path")
parser.add_argument("--model-path-mmd", type=Path, required=False, help="MMD Model input path")
parser.add_argument("--license-file-path", type=Path, required=False, help="License file path")
parser.add_argument(
"--mlflow-model-output-dir",
Expand Down Expand Up @@ -107,7 +108,7 @@ def run():
inference_base_image = args.inference_base_image

model_download_metadata_path = args.model_download_metadata
model_path = args.model_path
model_path = args.model_path_mmd if model_framework == 'MMLab' else args.model_path
mlflow_model_output_dir = args.mlflow_model_output_dir
license_file_path = args.license_file_path
TRUST_CODE_KEY = "trust_remote_code=True"
Expand Down
Loading