CLI v2 managed online endpoint deployment YAML file referencing an existing inbuilt environment - how?

Neil McAlister 371 Reputation points
2022-12-20T13:16:01.167+00:00

The following documentation specifies this option...

To reference an existing environment, use the azureml:<environment-name>:<environment-version> syntax.

https://learn.microsoft.com/en-gb/azure/machine-learning/reference-yaml-deployment-managed-online#:~:text=To%20reference%20an%20existing%20environment%2C%20use%20the%20azureml%3A%3Cenvironment%2Dname%3E%3A%3Cenvironment%2Dversion%3E%20syntax.

Can anyone help me work out what I need to put into the YAML deployment config file please - tried multiple things and nothing works. I tried to highlight this over at the documentation GitHub but they told me to come here - not a documentation issue apparently! There are no example around.

This is my deployment YAML file - I want to reference the Azure Machine Learning existing environment which is called AzureML-sklearn-1.0-ubuntu20.04-py38-cpu version 32

$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json  
model: azureml:my-model:1  
code_configuration:  
  code: models/my-model/  
  scoring_script: score.py  
environment:   
 ???????  
  conda_file: models/my-model/conda.yml  
instance_type: Standard_DS2_v2  
instance_count: 2  
app_insights_enabled: true  

Thank you in advance

Azure Machine Learning
0 comments No comments
{count} votes

Answer accepted by question author
  1. Ramr-msft 17,836 Reputation points
    2022-12-21T04:18:26.49+00:00

    @Neil McAlister Thanks for the question. Here is the sample to create a Deployment YAML Definition.

    $schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json ​  
      
    name: blue ​  
      
    endpoint_name: my-endpoint ​  
      
    model: ​  
      
        path: ../../model-1/model/ ​  
      
    code_configuration: ​  
      
        code: ../../model-1/onlinescoring/ ​  
      
        scoring_script: score.py ​  
      
    environment: ​  
      
        conda_file: ../../model-1/environment/conda.yml ​  
      
        image: mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:20210727.v1 ​  
      
    instance_type: Standard_DS2_v2 ​  
      
    instance_count: 1  
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Neil McAlister 371 Reputation points
    2022-12-22T09:14:44.067+00:00

    Hello @Ramr-msft and thank you for your reply

    I found that using your YAML it will create a repository for it in the connected Azure Container Registry

    When using the GUI to do the same operation though, it does not - this is preferred to keep costs under control

    I have found using the following environment statement works and a repository is not created in the Container Register, however I am unable to provide the conda yaml file in this definition as it fails syntax checks.

     $schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json  
     model: azureml:my-model:1  
     code_configuration:  
       code: models/my-model/  
       scoring_script: score.py  
    environment: azureml:AzureML-sklearn-1.0-ubuntu20.04-py38-cpu:32  
    instance_type: Standard_DS2_v2  
    instance_count: 2  
    app_insights_enabled: true  
    

    Give it a try and see the difference between GUI and YAML deployments using an existing environment with a conda requirements file

    Thanks

    Neil

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.