簡體   English   中英

Sagemaker 如何將調整步驟的最佳超參數傳遞給另一個估計器?

[英]Sagemaker how to pass tuning step's best hyperparameter into another estimator?

我正在運行一個包含 2 個步驟的Sagemaker 管道,調整然后訓練。 目的是通過調整獲得最佳超參數,然后在下一個訓練步驟中使用這些超參數。 我知道我可以使用HyperparameterTuningJobAnalytics在調整后檢索調整作業規范。 但是,我希望能夠使用依賴項之類的超參數並將它們直接傳遞給下一個 trainingStep 的估計器,請參見下面的代碼: hyperparameters=step_tuning.properties.BestTrainingJob.TunedHyperParameters,但這不適用於此錯誤消息: AttributeError: 'PropertiesMap' object has no attribute 'update'

tf_estimator_final = TensorFlow(entry_point='./train.py',
                          role=role,
                          sagemaker_session=sagemaker_session,
                          code_location=code_location,
                          instance_count=1,
                          instance_type="ml.p3.16xlarge",
                          framework_version='2.4',
                          py_version="py37",
                          base_job_name=base_job_name,
                          output_path=model_path, # if output_path not specified,
hyperparameters=step_tuning.properties.BestTrainingJob.TunedHyperParameters,
                          model_dir="/opt/ml/model",
                          script_mode=True
                          )

step_train = TrainingStep(
    name=base_job_name,
    estimator=tf_estimator_final,
    inputs={
        "train": TrainingInput(
            s3_data=train_s3
        )
    },
    depends_on = [step_tuning]
)

pipeline = Pipeline(
    name=jobname,
    steps=[
        step_tuning,
        step_train
    ],
    sagemaker_session=sagemaker_session
)

json.loads(pipeline.definition())

有什么建議么?

目前無法在 SageMaker Pipelines 中完成此操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM