本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
以下各節建議在管道步驟中使用@step
裝飾器時,應遵循的最佳實務。
使用暖集區
為了加快管道步驟的執行速度,請使用訓練任務提供的暖集區功能。您可以透過提供 keep_alive_period_in_seconds
引數給@step
裝飾器來開啟暖集區功能,如以下程式碼片段所示:
@step(
keep_alive_period_in_seconds=900
)
如需有關暖集區的詳細資訊,請參閱 SageMaker AI 受管暖集區。
建構您的目錄
建議您在使用@step
裝飾器時使用程式碼模組。將您調用步驟函數並定義管道的pipeline.py
模組放在工作區根目錄。建議的結構如下所示:
.
├── config.yaml # the configuration file that define the infra settings
├── requirements.txt # dependencies
├── pipeline.py # invoke @step-decorated functions and define the pipeline here
├── steps/
| ├── processing.py
| ├── train.py
├── data/
├── test/