ModuleStep 類別

建立 Azure Machine Learning 管線步驟,以執行特定版本的模組。

Module 物件會定義可重複使用的計算,例如腳本或可執行檔,可用於不同的機器學習案例和不同使用者。 若要在管線中使用模組的特定版本,請建立 ModuleStep。 ModuleStep 是管線中使用現有 ModuleVersion 的步驟。

如需使用 ModuleStep 的範例,請參閱筆記本 https://aka.ms/pl-modulestep

建立 Azure ML 管線步驟,以執行特定版本的模組。

繼承
ModuleStep

建構函式

ModuleStep(module=None, version=None, module_version=None, inputs_map=None, outputs_map=None, compute_target=None, runconfig=None, runconfig_pipeline_params=None, arguments=None, params=None, name=None, _workflow_provider=None)

參數

module
Module
預設值: None

步驟中使用的模組。 module提供 或 參數, module_version 但不提供兩者。

version
str
預設值: None

步驟中使用的模組版本。

module_version
ModuleVersion
預設值: None

步驟中使用的模組 ModuleVersion。 module提供 或 參數, module_version 但不提供兩者。

inputs_map
dict[str, Union[InputPortBinding, DataReference, PortDataReference, PipelineData, PipelineOutputAbstractDataset, DatasetConsumptionConfig]]
預設值: None

字典,會將 ModuleVersion 的埠定義名稱對應至步驟的輸入。

outputs_map
dict[str, Union[OutputPortBinding, DataReference, PortDataReference, PipelineData, PipelineOutputAbstractDataset]]
預設值: None

字典,會將 ModuleVersion 的埠定義名稱對應至步驟的輸出。

compute_target
Union[DsvmCompute, AmlCompute, RemoteCompute, HDInsightCompute, str, tuple]
預設值: None

要使用的計算目標。 如果未指定,則會使用 runconfig 中的目標。 可以是計算目標物件或工作區上計算目標的字串名稱。 或者,如果管線建立期間無法使用計算目標,您可以指定 ('compute target name' 的 Tuple、'compute target type') 以避免擷取計算目標物件, (AmlCompute 類型為 'AmlCompute' 且 RemoteCompute 類型為 'VirtualMachine') 。

runconfig
RunConfiguration
預設值: None

要使用的選擇性 RunConfiguration。 RunConfiguration 可用來指定執行的其他需求,例如 conda 相依性和 Docker 映射。

runconfig_pipeline_params
dict[str, PipelineParameter]
預設值: None

使用機碼/值組在執行時間覆寫 runconfig 屬性和該屬性的 PipelineParameter 名稱。

支援的值:'NodeCount'、'MpiProcessCountPerNode'、'TensorflowWorkerCount'、'TensorflowParameterServerCount'

arguments
list[str]
預設值: None

Python 腳本檔案的命令列引數清單。 引數會透過 RunConfiguration 中的引數傳遞至計算目標。 如需如何處理特殊符號等引數的詳細資訊,請參閱 中的引數 RunConfiguration

params
dict[str, str]
預設值: None

名稱/值組的字典。

name
str
預設值: None

步驟的名稱。

_workflow_provider
<xref:azureml.pipeline.core._aeva_provider._AevaWorkflowProvider>
預設值: None

(內部僅使用。) 工作流程提供者。

module
Module
必要

步驟中使用的模組。 module提供 或 參數, module_version 但不提供兩者。

version
str
必要

步驟中使用的模組版本。

module_version
ModuleVersion
必要

步驟中使用的模組 ModuleVersion。 module提供 或 參數, module_version 但不提供兩者。

inputs_map
dict[str, Union[InputPortBinding, DataReference, PortDataReference, PipelineData, <xref:azureml.pipeline.core.pipeline_output_dataset.PipelineOutputDataset>, DatasetConsumptionConfig]]
必要

字典,會將 ModuleVersion 的埠定義名稱對應至步驟的輸入。

outputs_map
dict[str, Union[InputPortBinding, DataReference, PortDataReference, PipelineData, <xref:azureml.pipeline.core.pipeline_output_dataset.PipelineOutputDataset>]]
必要

字典,會將 ModuleVersion 的埠定義名稱對應至步驟的輸出。

compute_target
Union[DsvmCompute, AmlCompute, RemoteCompute, HDInsightCompute, str, tuple]
必要

要使用的計算目標。 如果未指定,則會使用 runconfig 中的目標。 可以是計算目標物件或工作區上計算目標的字串名稱。 或者,如果管線建立期間無法使用計算目標,您可以指定 ('compute target name' 的 Tuple、'compute target type') 以避免擷取計算目標物件, (AmlCompute 類型為 'AmlCompute' 且 RemoteCompute 類型為 'VirtualMachine') 。

runconfig
RunConfiguration
必要

要使用的選擇性 RunConfiguration。 RunConfiguration 可用來指定執行的其他需求,例如 conda 相依性和 Docker 映射。

runconfig_pipeline_params
dict[str, PipelineParameter]
必要

使用機碼/值組在執行時間覆寫 runconfig 屬性和該屬性的 PipelineParameter 名稱。

支援的值:'NodeCount'、'MpiProcessCountPerNode'、'TensorflowWorkerCount'、'TensorflowParameterServerCount'

arguments
list[str]
必要

Python 腳本檔案的命令列引數清單。 引數會透過 RunConfiguration 中的引數傳遞至計算目標。 如需如何處理特殊符號等引數的詳細資訊,請參閱 中的引數 RunConfiguration

params
dict[str, str]
必要

名稱/值組的字典。

name
str
必要

步驟的名稱。

_wokflow_provider
必要

(內部僅使用。) 工作流程提供者。

備註

Module可用來建立和管理 Azure Machine Learning 管線的可重複使用計算單位。 ModuleStep 是 Azure Machine Learning 中用來取用模組的內建步驟。 您可以明確定義要使用的 ModuleVersion,或讓 Azure Machine Learning 解析要使用哪一個 ModuleVersion,遵循 類別的備註一節 Module 中所定義的解析程式。 若要定義提交管線中使用的 ModuleVersion,請在建立 ModuleStep 時定義下列其中一項:

  • ModuleVersion 物件。

  • Module物件和版本值。

  • Module沒有版本值的 物件。 在此情況下,版本解析可能會因提交而有所不同。

您必須定義 ModuleStep 的輸入和輸出與 ModuleVersion 輸入和輸出之間的對應。

下列範例示範如何使用多個 ModuleStep 物件,建立 ModuleStep 做為管線的一部分:


   middle_step = ModuleStep(module=module,
                            inputs_map= middle_step_input_wiring,
                            outputs_map= middle_step_output_wiring,
                            runconfig=RunConfiguration(), compute_target=aml_compute,
                            arguments = ["--file_num1", first_sum, "--file_num2", first_prod,
                                         "--output_sum", middle_sum, "--output_product", middle_prod])

完整範例可從 https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-how-to-use-modulestep.ipynb

方法

create_node

從 ModuleStep 步驟建立節點,並將它新增至指定的圖形。

這個方法不適合直接使用。 使用此步驟具現化管線時,Azure ML 會自動傳遞透過此方法所需的參數,以便將步驟新增至代表工作流程的管線圖形。

create_node

從 ModuleStep 步驟建立節點,並將它新增至指定的圖形。

這個方法不適合直接使用。 使用此步驟具現化管線時,Azure ML 會自動傳遞透過此方法所需的參數,以便將步驟新增至代表工作流程的管線圖形。

create_node(graph, default_datastore, context)

參數

graph
Graph
必要

要加入節點的繪圖物件。

default_datastore
Union[AbstractAzureStorageDatastore, AzureDataLakeDatastore]
必要

預設資料存放區。

context
<xref:azureml.pipeline.core._GraphContext>
必要

圖形內容。

傳回

node 物件。

傳回類型