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

Batch component added for deployment and inference #859

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ab3da8a
Batch component added for deployment and inderence
tanmaybansal104 Jul 10, 2023
b44633a
Removed Sytax check errors
tanmaybansal104 Jul 10, 2023
dc4bc5e
Removed Sytax check errors
tanmaybansal104 Jul 10, 2023
5b5b099
Changed OnlineEndpointInvocationError to BatchEndpointInvocationError
tanmaybansal104 Jul 10, 2023
5f4b3a1
Removed Sytax check errors
tanmaybansal104 Jul 10, 2023
a5e8d4a
Updated descriptions and default values. Added compute cluster check.
tanmaybansal104 Jul 12, 2023
8d4693c
Removed syntax check errors
tanmaybansal104 Jul 12, 2023
f099a21
Modularized the compute cluster creation and updated the descriptions
tanmaybansal104 Jul 14, 2023
9b950d0
Defined default constant values for batch component
tanmaybansal104 Jul 18, 2023
529294b
Added file and folder inference for batch component
tanmaybansal104 Jul 20, 2023
22e14f2
Modularized invoke_endpoint_job for batch component
tanmaybansal104 Jul 20, 2023
aae4b23
Fixed file path for batch component
tanmaybansal104 Jul 20, 2023
c82bf1e
Merged main into the branch
tanmaybansal104 Jul 21, 2023
f3d76a3
Changed registration file to folder for batch model deploy
tanmaybansal104 Jul 21, 2023
eb58960
Fixed syntax checks for batch deploy component
tanmaybansal104 Jul 21, 2023
05a8fec
Fixed syntax checks for batch deploy component
tanmaybansal104 Jul 21, 2023
121adda
Added batch job output folder
tanmaybansal104 Jul 24, 2023
c835413
Removed Syntax check errors
tanmaybansal104 Jul 24, 2023
022d239
Changed file path for batch deploy component
tanmaybansal104 Jul 24, 2023
3ca64b6
Changed the file structure for batch component output download
tanmaybansal104 Jul 25, 2023
de60196
Removed Syntax check errors
tanmaybansal104 Jul 25, 2023
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
8 changes: 4 additions & 4 deletions assets/common/components/batch_deploy_model/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ command: >-
$[[--logging_level ${{inputs.logging_level}}]]
$[[--mini_batch_size ${{inputs.mini_batch_size}}]]
$[[--instance_count ${{inputs.instance_count}}]]
--model_deployment_details ${{outputs.model_deployment_details}}
--batch_job_output_folder ${{outputs.batch_job_output_folder}}

inputs:
# Output of registering component
Expand Down Expand Up @@ -188,9 +188,9 @@ inputs:
description: The number of nodes to use for each batch scoring job.
tanmaybansal104 marked this conversation as resolved.
Show resolved Hide resolved

outputs:
model_deployment_details:
type: uri_file
description: Json file to which deployment details will be written
batch_job_output_folder:
type: uri_folder
description: Folder to which batch job outputs will be saved.

tags:
Preview: ""
Expand Down
15 changes: 8 additions & 7 deletions assets/common/src/batch_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def parse_args():
choices=range(1, MAX_INSTANCE_COUNT),
)
parser.add_argument(
"--model_deployment_details",
type=str,
help="Json file to which deployment details will be written",
"--batch_job_output_folder",
type=Path,
help="Folder to which batch job outputs will be saved",
)
# parse args
args = parser.parse_args()
Expand Down Expand Up @@ -194,18 +194,18 @@ def invoke_endpoint_job(ml_client, endpoint, type, args):
scoring_job = list(ml_client.jobs.list(parent_job_name=job.name))[0]

ml_client.jobs.download(
tanmaybansal104 marked this conversation as resolved.
Show resolved Hide resolved
name=scoring_job.name, download_path=".", output_name="score"
name=scoring_job.name, download_path=args.batch_job_output_folder, output_name="score"
tanmaybansal104 marked this conversation as resolved.
Show resolved Hide resolved
)

logger.info(f"Endpoint invoked successfully with {type} test payload.")
logger.info(f"Endpoint invoked successfully with {type} test payload. Output stored in {args.output_file_name} file.")
except Exception as e:
raise AzureMLException._with_error(
AzureMLError.create(BatchEndpointInvocationError, exception=e)
)


def get_or_create_compute(ml_client, compute_name, args):
"""Get or create the compute cluster."""
"""Get or create the compute cluster and return details."""
try:
compute_cluster = ml_client.compute.get(compute_name)
logger.info(f"Using compute cluster {compute_name}.")
Expand Down Expand Up @@ -372,7 +372,8 @@ def main():
"max_concurrency_per_instance": deployment.max_concurrency_per_instance,
}
json_object = json.dumps(deployment_details, indent=4)
with open(args.model_deployment_details, "w") as outfile:
file_path = str(args.batch_job_output_folder) + "/model_deployment_details.json"
tanmaybansal104 marked this conversation as resolved.
Show resolved Hide resolved
with open(file_path, "w") as outfile:
outfile.write(json_object)
logger.info("Saved deployment details in output json file.")

Expand Down
Loading