【以下的问题经过翻译处理】 大家好,
我正在使用DeepAR算法构建ML模型。
当我使用时,遇到了这个错误:
错误:
ClientError: An error occurred (UnknownOperationException) when calling the CreateHyperParameterTuningJob operation: The requested operation is not supported in the called region
代码:
from sagemaker.tuner import (
整数参数,
分类参数,
连续参数,
超参数调整器,
)
from sagemaker import image_uris
container = image_uris.retrieve(region = 'af-south-1', framework="forecasting-deepar")
deepar = sagemaker.estimator.Estimator(
container,
role,
instance_count=1,
instance_type="ml.m5.2xlarge",
use_spot_instances=True, # 使用spot instances
max_run=1800, # 最大训练时间(秒)
max_wait=1800, # 等待spot实例的秒数
output_path="s3://{}/{}".format(bucket, output_path),
sagemaker_session=sess,
)
freq = "D"
context_length = 300
deepar.set_hyperparameters(
time_freq=freq, context_length=str(context_length), prediction_length=str(prediction_length)
)
请问您能帮忙解决这个错误吗?我必须在af-south-1地区完成这个任务。
谢谢,
巴斯姆
超参数范围为:
“mini_batch_size”:IntegerParameter(100, 400),
“epochs”:IntegerParameter(200, 400),
“num_cells”:IntegerParameter(30, 100),
“likelihood”:CategoricalParameter(['negative-binomial', 'student-T']),
“learning_rate”:ContinuousParameter(0.0001, 0.1),
objective_metric_name #ERROR!st:RMSE“,
tuner = HyperparameterTuner(
deepar,
objective_metric_name,
hyperparameter_ranges,
max_jobs=10,
strategy=“Bayesian”,
objective_type=“Minimize”,
max_parallel_jobs=10,
early_stopping_type=“Auto”,
)
s3_input_train = sagemaker.inputs.TrainingInput( s3_data="s3://{}/{}/train/".format(bucket, prefix), content_type="json" ) s3_input_test = sagemaker.inputs.TrainingInput( s3_data="s3://{}/{}/test/".format(bucket, prefix), content_type="json" )
tuner.fit({"train": s3_input_train, "test": s3_input_test}, include_cls_metadata=False) tuner.wait()