dsl パッケージ

機能

pipeline

この関数で定義されているすべてのコンポーネント ノードを含むパイプラインを構築します。

pipeline(func: Callable[[P], T] | None = None, *, name: str | None = None, version: str | None = None, display_name: str | None = None, description: str | None = None, experiment_name: str | None = None, tags: Dict[str, str] | None = None, **kwargs) -> Callable[[Callable[[P], T]], Callable[[P], PipelineJob]] | Callable[[P], PipelineJob]

パラメーター

func
FunctionType
既定値: None

装飾するユーザー パイプライン関数。

name
str

パイプライン コンポーネントの名前。既定値は関数名です。

version
str

パイプライン コンポーネントのバージョンは、既定値は "1" です。

display_name
str

パイプライン コンポーネントの表示名。既定値は関数名です。

description
str

ビルドされたパイプラインの説明。

experiment_name
str

ジョブが作成される実験の名前。None が指定されている場合、実験は現在のディレクトリに設定されます。

tags
dict[str, str]

パイプライン コンポーネントのタグ。

kwargs
dict

追加の構成パラメーターのディクショナリ。

戻り値

接続前/接続後

  • func が None の場合、デコレーター
  • 装飾された ファンク

の戻り値の型 :

このデコレーターを使用してパイプラインを作成する方法を示します。


   from azure.ai.ml import load_component
   from azure.ai.ml.dsl import pipeline

   component_func = load_component(
       source="./sdk/ml/azure-ai-ml/tests/test_configs/components/helloworld_component.yml"
   )

   # Define a pipeline with decorator
   @pipeline(name="sample_pipeline", description="pipeline description")
   def sample_pipeline_func(pipeline_input1, pipeline_input2):
       # component1 and component2 will be added into the current pipeline
       component1 = component_func(component_in_number=pipeline_input1, component_in_path=uri_file_input)
       component2 = component_func(component_in_number=pipeline_input2, component_in_path=uri_file_input)
       # A decorated pipeline function needs to return outputs.
       # In this case, the pipeline has two outputs: component1's output1 and component2's output1,
       # and let's rename them to 'pipeline_output1' and 'pipeline_output2'
       return {
           "pipeline_output1": component1.outputs.component_out_path,
           "pipeline_output2": component2.outputs.component_out_path,
       }

   # E.g.: This call returns a pipeline job with nodes=[component1, component2],
   pipeline_job = sample_pipeline_func(
       pipeline_input1=1.0,
       pipeline_input2=2.0,
   )
   ml_client.jobs.create_or_update(pipeline_job, experiment_name="pipeline_samples", compute="cpu-cluster")