【问题标题】:How to use Pipeline parameters on AzureML如何在 AzureML 上使用管道参数
【发布时间】:2020-12-10 09:10:44
【问题描述】:

我在 AzureML Designer 上构建了一个管道,我正在尝试使用管道参数,但我无法在 python 脚本模块上获取这些参数的值。

https://docs.microsoft.com/en-us/azure/machine-learning/how-to-create-your-first-pipeline 本文档包含一个名为“对在推理时更改的参数使用管道参数”的部分,但不幸的是,它是空的。

我正在定义管道设置的参数,请参阅底部的屏幕截图。有谁知道在使用 Designer 构建管道时如何使用参数?

【问题讨论】:

    标签: azure azure-machine-learning-studio azureml azureml-python-sdk


    【解决方案1】:

    您可以将每个流水线阶段的输出与其输入相关联。例如鉴于模型评估的结果,我们应该能够轻松识别与所述评估相关的所有工件(模型评估配置、模型规范、模型参数、训练脚本、训练数据等)。

    Azure Machine Learning Pipelines 参考文章: https://github.com/Azure/MachineLearningNotebooks/blob/4a3f8e7025334ea8c0de0bada69b031ce54c24a0/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-use-databricks-as-compute-target.ipynb

    我们有一个 AMLS 管道尝试使用日期字符串进行参数化,以在旧历史日期的上下文中处理我们的管道。

    这是我们用来提交pipeline的代码

    from azureml.core.authentication import InteractiveLoginAuthentication
    import requests
     
    auth = InteractiveLoginAuthentication()
    aad_token = auth.get_authentication_header()
     
    rest_endpoint = published_pipeline.endpoint
     
    print("You can perform HTTP POST on URL {} to trigger this pipeline".format(rest_endpoint))
     
    # specify the param when running the pipeline
    response = requests.post(rest_endpoint, 
                             headers=aad_token, 
                             json={"ExperimentName": "dtpred-Dock2RTEG-EX-param",
                                   "RunSource": "SDK",
                                   "DataPathAssignments": {"input_datapath": {"DataStoreName": "erpgen2datastore","RelativePath": "teams/PredictiveInsights/DatePrediction/2019/10/10"}},
                                   "ParameterAssignments": {"param_inputDate": "2019/10/10"}})
    run_id = response.json()["Id"]
    print('Submitted pipeline run: ', run_id)
    

    【讨论】:

    • 感谢 Ram-msft 的回答。我确实知道如何在请求中发送参数,但是,我不知道如何在运行时使用它们(例如在管道中包含的 python 脚本中)。
    • 谢谢,请分享您正在尝试的python脚本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 2020-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多