azureazure-functionsazure-machine-learning-serviceazure-python-sdkazuremlsdk

Azure ml : Difference between ScriptRunConfig vs command


I'm trying to start a training job on Azure ML from an Azure function (blob trigger) using Python. Here're the two ways I've seen it done:

  1. Using the command function from azure.ai.ml
    inputs=dict(
        data_folder=Input(type="uri_folder", path=web_path)
    ),
    compute=gpu_compute_target,
    environment=curated_env_name,
    code="./src/",
    command="python tf_mnist.py --data-folder ${{inputs.data_folder}}",
    experiment_name="tf-dnn-image-classify",
    display_name="tensorflow-classify-mnist-digit-images-with-dnn",
)
ml_client.jobs.create_or_update(job)
  1. Using ScriptRunConfig class from azureml.core
                      script='train.py', 
                      arguments=['--input-data-dir', dataset.as_named_input('input').as_mount(),
                                 '--reg', '0.99'],
                      run_config=run_config) 
run = experiment.submit(config=src)

What is the difference between these? My source code is in a remote repo and this bit of code would be running in an Azure function. Which of these methods is suitable for my scenario?


Solution

  • They key difference between those methods is just the version of the SDK/API that they are using.

    I would suggest using the V2 SDK, it is clearly more future-proof (though of course you may hit some snags for now because the V2 SDK is still in preview mode). Our team are also now switching from V1 to V2.