Share via

Assigning Version to Custom Environment in Azure.ai.ml Command Execution

Saeed Misaghian 20 Reputation points
2023-12-13T22:00:06.98+00:00

I am currently encountering an issue that I have been unable to resolve. Despite seeming straightforward, it has proven to be quite challenging.

I am attempting to execute a Python script via a command from azure.ai.ml. My script incorporates an XGBoost model, which necessitates a customized environment. I have made several attempts to customize the environment within the command, but each attempt has resulted in an error message indicating that I need to assign a version to the environment. Interestingly, the Environment class does not accept a version as it is not an argument within that class.

Could you please provide guidance on how I can resolve this issue?

I appreciate your assistance and look forward to your response.

Best regards, Saeed

custom_env = Environment.from_conda_specification(name="custom_env", file_path="conda_env.yml")
custom_env.register(workspace=ws)

# configure job

job = command(
    code="./src",
    command="python train-model-script.py --training_data ./data/energy_data.xlsx",
    environment="env-name",
    compute="aml-cluster",
    display_name="building-energy-train",
    experiment_name="building-energy-training", 
    tags={"model_type": "XGBOOST", "model":"Building energy dataset"}
    )

# submit job
returned_job = ml_client.create_or_update(job)
aml_url = returned_job.studio_url


yamle file: 
name: my_env
dependencies:
  - python
  - scikit-learn
  - xgboost
  - argparse
  - numpy
  - pandas
  - matplotlib
Azure Machine Learning

Answer accepted by question author
  1. dupammi 8,615 Reputation points Microsoft External Staff
    2023-12-15T23:47:58.0666667+00:00

    Hi @Saeed Misaghian ,

    You're welcome! I'm pleased to learn that you've successfully identified an issue and have promptly submitted it to Microsoft Azure's GitHub repository.

    Thank you for understanding!

    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.