PortDataReference 類別
建立與已完成 StepRun 輸出相關聯的模型資料。
PortDataReference 物件可用來下載 所產生的 StepRun 輸出資料。 它也可作為未來管線中的步驟輸入。
初始化 PortDataReference。
- 繼承
-
builtins.objectPortDataReference
建構函式
PortDataReference(context, pipeline_run_id, data_reference, step_run=None)
參數
- context
- <xref:azureml.pipeline.core._GraphContext>
圖形內容物件。
- context
- <xref:azureml.pipeline.core._GraphContext>
圖形內容物件。
備註
PortDataReference 指向已完成 StepRun 所產生的資料。
從 PipelineRun 取得 PortDataReference 並下載輸出資料,如下所示:
from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_run = pipeline_run.find_step_run("<node_name>")[0]
port_data_reference = step_run.get_output_data("<output_name>")
port_data_reference.download(local_path="path")
PortDataReference 可作為 中 Pipeline 步驟的輸入,類似于使用 DataReference 。
使用 PortDataReference 作為步驟輸入的範例如下:
from azureml.pipeline.core import PortDataReference, Pipeline, PipelineRun
from azureml.pipeline.steps import PythonScriptStep
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_run = pipeline_run.find_step_run("<node_name>")[0]
port_data_reference = step_run.get_output_data("<output_name>")
step_1 = PythonScriptStep(
name='train',
script_name="train.py",
compute_target=compute,
arguments=["--input", port_data_reference],
inputs=[port_data_reference]
)
pipeline = Pipeline(workspace=workspace, steps=[step_1])
在此範例中,新建構的 Pipeline 會使用已完成 PipelineRun 所建立的輸出作為定型步驟的輸入。
方法
as_download |
透過「下載」模式,使用 PortDataReference 作為步驟輸入。 |
as_input |
建立 InputPortBinding 並指定輸入名稱 (,但使用預設模式) 。 |
as_mount |
透過「掛接」模式,使用 PortDataReference 作為步驟輸入。 |
create_input_binding |
使用此 PortDataReference 作為來源建立輸入系結。 |
download |
下載 PortDataReference 所代表的資料。 |
as_download
透過「下載」模式,使用 PortDataReference 作為步驟輸入。
as_download(input_name=None, path_on_compute=None, overwrite=None)
參數
傳回
使用這個 PortDataReference 作為來源的 InputPortBinding。
傳回類型
as_input
建立 InputPortBinding 並指定輸入名稱 (,但使用預設模式) 。
as_input(input_name)
參數
傳回
使用這個 PortDataReference 作為來源的 InputPortBinding。
傳回類型
as_mount
透過「掛接」模式,使用 PortDataReference 作為步驟輸入。
as_mount(input_name=None)
參數
傳回
使用這個 PortDataReference 作為來源的 InputPortBinding。
傳回類型
create_input_binding
使用此 PortDataReference 作為來源建立輸入系結。
create_input_binding(input_name=None, mode=None, path_on_compute=None, overwrite=None)
參數
傳回
使用這個 PortDataReference 作為來源的 InputPortBinding。
傳回類型
download
下載 PortDataReference 所代表的資料。
download(local_path, overwrite=None, show_progress=None)
參數
傳回
已成功下載的檔案數目。
傳回類型
屬性
datastore
datastore_name
name
path_on_datastore
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應