Python代码在Azure ML实验中失败,但在conda环境中运行



我已经在我的Azure ML计算实例中创建了自定义conda环境,并验证了python代码在该环境中运行。然而,当我在Azure ML实验中提交.py文件时,即使为实验设置了相同的conda环境,运行也会失败。

这就是我提交实验的方式:

ws = Workspace.from_config()
compute_name = os.environ.get("AML_COMPUTE_CLUSTER_NAME", "mycompute_cluster")
compute_target = ws.compute_targets[compute_name]
env = Environment.from_existing_conda_environment('expEnv', "myEnv")
experiment = Experiment(workspace=ws, name='exp')
config = ScriptRunConfig(source_directory='./',
script='exp1.py',
compute_target=compute_target)
config.run_config.environment = env
run = experiment.submit(config)
aml_url = run.get_portal_url()
print(aml_url)

我还尝试从conda-YAML文件创建Azure ML环境,并在提交实验时使用它,但我仍然收到了同样的错误。

错误:

UserError:模块"tensorflow.python.training.experiment.mixed_preccision"没有属性"_register_wrapper_optimizer_cls">

似乎缺少或重命名了所需的模块。您需要确保您在代码中使用的是具有必需属性的相同模块版本。

此外,您可能需要按照@HarshithaVeeramalla MT在评论部分中的建议,使用pip3 install tf-nightly命令安装模块tf-nightly

相关内容

最新更新