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

작업이 만들어질 실험의 이름입니다. 없음이 제공된 경우 실험은 현재 디렉터리로 설정됩니다.

tags
dict[str, str]

파이프라인 구성 요소의 태그입니다.

kwargs
dict

추가 구성 매개 변수의 사전입니다.

반환

여기서는

  • 데코레이터( func 가 None인 경우)
  • 장식 된 func

반환 형식

예제

이 데코레이터를 사용하여 파이프라인을 만드는 방법을 보여 줍니다.


   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")