

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 @step 裝飾項目直接移轉程式碼
<a name="pipelines-step-decorator"></a>

`@step` 裝飾項目是將本機機器學習 (ML) 程式碼轉換為一或多個管道步驟的特徵。您可以像撰寫任何 ML 專案一樣撰寫 ML 函式。一旦使用 `@remote` 裝飾項目在本機或做為訓練任務測試，您就可以透過新增 `@step` 裝飾項目，將函式轉換為 SageMaker AI 管道步驟。然後，您可以將 `@step` 裝飾的函式呼叫的輸出做為步驟傳遞至 Pipelines，以建立和執行管道。您也可以使用 `@step` 裝飾項目鏈結一系列函式，以建立多步驟有向無環圖 (DAG) 管道。

使用 `@step` 裝飾項目的設定與使用 `@remote` 裝飾項目的設定相同。如需如何[設定環境](https://docs.aws.amazon.com/sagemaker/latest/dg/train-remote-decorator.html#train-remote-decorator-env)和[使用組態檔案](https://docs.aws.amazon.com/sagemaker/latest/dg/train-remote-decorator-config.html)來設定預設值的詳細資訊，請參閱遠端函式文件。如需 `@step` 裝飾項目的詳細資訊，請參閱。[sagemaker.workflow.function\_step.step](https://sagemaker.readthedocs.io/en/stable/workflows/pipelines/sagemaker.workflow.pipelines.html#sagemaker.workflow.function_step.step)。

若要檢視示範如何使用 `@step` 裝飾項目的範例筆記本，請參閱 [@step 裝飾項目範例筆記本](https://github.com/aws/amazon-sagemaker-examples/tree/main/sagemaker-pipelines/step-decorator)。

下列各節說明如何使用 `@step` 裝飾項目註釋您的本機 ML 程式碼，以建立步驟、使用步驟建立和執行管道，以及為您的使用案例自訂體驗。

**Topics**
+ [使用 `@step` 裝飾的函式建立管道](pipelines-step-decorator-create-pipeline.md)
+ [執行管道](pipelines-step-decorator-run-pipeline.md)
+ [設定您的管道](pipelines-step-decorator-cfg-pipeline.md)
+ [最佳實務](pipelines-step-decorator-best.md)
+ [限制](pipelines-step-decorator-limit.md)