[英]Environment conflict within an azure ML pipeline
到目前為止,我一直在 azure 上使用我的 model 培訓管道,沒有任何問題。 上周我啟動它並收到有關環境版本沖突的錯誤。 我什么都沒改變,但它不再起作用了。 我該如何解決這個問題?
from azureml.train.automl import automl\nImportError: cannot import name 'automl' from 'azureml.train.automl'
我也同時開始收到此警告。
WARNING:azureml.pipeline.core.run:Expected a StepRun object but received <class 'azureml.core.run.Run'> instead.
This usually indicates a package conflict with one of the dependencies of azureml-core or azureml-pipeline-core.
Please check for package conflicts in your python environment
這是我的環境筆記本塊:
from azureml.core.runconfig import RunConfiguration
from azureml.core.conda_dependencies import CondaDependencies
aml_run_config = RunConfiguration()
# Use just-specified compute target ("cpu-cluster")
aml_run_config.target = compute_target
# Specify CondaDependencies obj, add necessary packages
aml_run_config.environment.python.conda_dependencies = CondaDependencies.create(
conda_packages=['pandas','scikit-learn','pyodbc'],
pip_packages=['azureml-sdk[automl]','pyarrow', 'azureml-core>=1.42.0', 'msrest==0.6.21', 'xgboost'])
我嘗試更改 azureml-core、sdk、mrest 等的版本控制,但它仍然給我同樣的錯誤。
from azureml.train.automl import automl
上面的語法用於導入 automl. 但由於版本更新,無法使用Automl特性的程序。 以下兩個過程是可用於替換現有工作的代碼塊。
from azure.ai.ml import automl, Input
上面的代碼塊可用於檢索執行 autoML 訓練所需的所有功能。 使用上述語法后
# training data from your local directory
my_training_data_input = Input(
type=AssetTypes.MLTABLE, path="./data/training-mltable-folder"
)
# Remote MLTable definition
my_training_data_input = Input(type=AssetTypes.MLTABLE, path="azureml://datastores/workspaceblobstore/paths/Classification/Train")
# note that the below is a code snippet -- you might have to modify the variable values to run it successfully
classification_job = automl.classification(
compute=my_compute_name,
experiment_name=my_exp_name,
training_data=my_training_data_input,
target_column_name="y",
primary_metric="accuracy",
n_cross_validations=5,
enable_model_explainability=True,
tags={"my_custom_tag": "My custom value"}
)
# Limits are all optional
classification_job.set_limits(
timeout_minutes=600,
trial_timeout_minutes=20,
max_trials=5,
enable_early_termination=True,
)
# Training properties are optional
classification_job.set_training(
blocked_training_algorithms=["LogisticRegression"],
enable_onnx_compatible_models=True
)
以上是在訓練 model 中使用的屬性。
這是實現類似工作的另一種方法。
Using AutoMLRun class can help to run the model.
from azureml.train.automl.run import AutoMLRun
ws = Workspace.from_config()
experiment = ws.experiments['my-experiment-name']
automl_run = AutoMLRun(experiment, run_id = your run ID')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.