A data scientist has a training script, train.py, that calls mlflow.log_metric(). She installed the mlflow and azureml-mlflow packages with pip on her workstation, and the script runs there without errors.
She submits the script as an Azure Machine Learning command job. The job runs on the compute cluster aml-cluster and references a registered environment named base-env. The Conda YAML file for base-env lists python, pip, numpy, pandas and scikit-learn only. The job fails when the script imports mlflow.
What should she do so that the job runs and tracks the metric with the job run?
A command job runs on the compute you select, not on the workstation that submits it. Any package the script needs, such as mlflow and azureml-mlflow, must be included in the job's environment. You can describe the environment in a Conda YAML file and register it. You must then reference that environment when you submit the job, because a registered environment the job does not use changes nothing.
- Correct: Add both packages to a Conda YAML file, register an environment from it, and reference that environment in the job. The packages must be on the compute that executes the script. Defining them in a Conda YAML file, registering the environment and referring to it in the job installs them on aml-cluster.
- Not correct: Register a new environment from an updated Conda YAML file, and keep base-env as the job's environment. The environment that the job refers to must include the necessary packages. The job still uses base-env, which lacks mlflow and azureml-mlflow.
- Not correct: Upgrade both packages on her workstation with pip, and then submit the same job again without other changes. The packages must be installed on the compute executing the script. The job runs on aml-cluster, not on her workstation, so local packages do not help.
- Not correct: Add import statements for mlflow and azureml.mlflow at the top of train.py, and then resubmit the job. Import statements do not install packages. The packages must be included in the environment so they are installed on the compute that runs the script.