PythonScriptStep 中的日志指标

Log metrics in PythonScriptStep

在我的 Azure ML 管道中,我有一个 PythonScriptStep 正在处理一些数据。我需要访问 Azure ML Logger 以跟踪该步骤中的指标,因此我尝试导入 get_azureml_logger,但结果失败了。我不确定我需要通过 pip 安装什么依赖项。

from azureml.logging import get_azureml_logger

ModuleNotFoundError: No module named 'azureml.logging'

我遇到了类似的 ,但它涉及 Azure Notebooks。无论如何,我尝试将该 blob 添加到我的 pip 依赖项中,但它因 Auth 错误而失败。

Collecting azureml.logging==1.0.79 [91m  ERROR: HTTP error 403 while getting
https://azuremldownloads.blob.core.windows.net/wheels/latest/azureml.logging-1.0.79-py3-none-any.whl?sv=2016-05-31&si=ro-2017&sr=c&sig=xnUdTm0B%2F%2FfknhTaRInBXyu2QTTt8wA3OsXwGVgU%2BJk%3D
[0m91m  ERROR: Could not install requirement azureml.logging==1.0.79 from
https://azuremldownloads.blob.core.windows.net/wheels/latest/azureml.logging-1.0.79-py3-none-any.whl?sv=2016-05-31&si=ro-2017&sr=c&sig=xnUdTm0B%2F%2FfknhTaRInBXyu2QTTt8wA3OsXwGVgU%2BJk%3D
(from -r /azureml-environment-setup/condaenv.g4q7suee.requirements.txt
(line 3)) because of error 403 Client Error:
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. for url:
https://azuremldownloads.blob.core.windows.net/wheels/latest/azureml.logging-1.0.79-py3-none-any.whl?sv=2016-05-31&si=ro-2017&sr=c&sig=xnUdTm0B%2F%2FfknhTaRInBXyu2QTTt8wA3OsXwGVgU%2BJk%3D

我不确定如何进行此操作,我需要做的就是在该步骤中记录指标。

查看 ScriptRunConfig Section of the Monitor Azure ML experiment runs and metricsScriptRunConfigPythonScriptStep.

的工作原理相同

成语一般是在你的PythonScriptStep的脚本中有以下内容:

from azureml.core.run import Run
run = Run.get_context()
run.log('foo_score', "bar")

旁注:您无需更改环境依赖项即可使用它,因为 PythonScriptStep 已经 azureml-defaults 作为依赖项自动安装。