While Deploying a Machine Learning Model using the AZ CLI, the command
az ml model deploy --name $(AKS_DEPLOYMENT_NAME)
--model '$(MODEL_NAME):$(get_model.MODEL_VERSION)' \
--compute-target $(AKS_COMPUTE_NAME) \
--ic inference_config.yml \
--dc deployment_config_aks.yml \
-g $(RESOURCE_GROUP) --workspace-name $(WORKSPACE_NAME) \
--overwrite -v
Will use the inference_config.yml
and deployment_config_aks.yml
file to deploy the model.
However, if we are using the azureml-sdk
in Python, the commands are:
from azureml.core import Environment
from azureml.core.conda_dependencies import CondaDependencies
conda_deps = CondaDependencies.create(conda_packages=['numpy','scikit-learn==0.19.1','scipy'], #for-example
pip_packages=['azureml-defaults', 'inference-schema']) #for-example
myenv = Environment(name='myenv')
myenv.python.conda_dependencies = conda_deps
from azureml.core.model import InferenceConfig
inf_config = InferenceConfig(entry_script='score.py', environment=myenv)
aks_config = AksWebservice.deploy_configuration()
aks_service_name ='some-name'
aks_service = Model.deploy(workspace=ws,
name=aks_service_name,
models=[model],
inference_config=inf_config,
deployment_config=aks_config,
deployment_target=aks_target)
How exactly can we use a Conda Dependencies file conda_dependencies.yml
, Inference_Config File inference_config.yml
and Deployment Config File deployment_config_aks.yml
to create objects inf_config
and aks_config
to use in Python? Is there a .from_file()
option to use the YAML definitions? My use case is to create Python Steps in Azure Pipelines as an MLOps workflow!