我正在尝试使用AWS sagemaker cli来运行create-training-job命令。这是我的命令:
aws sagemaker create-training-job \
--training-job-name $(DEPLOYMENT_NAME)-$(BUILD_ID) \
--hyper-parameters file://sagemaker/hyperparameters.json \
--algorithm-specification TrainingImage=$(IMAGE_NAME),\
TrainingInputMode="File" \
--role-arn $(ROLE) \
--input-data-config ChannelName=training,DataSource={S3DataSource={S3DataType=S3Prefix,S3Uri=$(S3_INPUT),S3DataDistributionType=FullyReplicated}},ContentType=string,CompressionType=None,RecordWrapperType=None \
--output-data-config S3OutputPath=$(S3_OUTPUT) \
--resource-config file://sagemaker/train-resource-config.json \
--stopping-condition file://sagemaker/stopping-conditions.json
这是错误:
Parameter validation failed:
Invalid type for parameter InputDataConfig[0].DataSource.S3DataSource, value: S3DataType=S3Prefix, type: <type 'unicode'>, valid types: <type 'dict'>
Invalid type for parameter InputDataConfig[1].DataSource.S3DataSource, value: S3Uri=s3://hs-machine-learning-processed-production/inbound-autotag/data, type: <type 'unicode'>, valid types: <type 'dict'>
Invalid type for parameter InputDataConfig[2].DataSource.S3DataSource, value: S3DataDistributionType=FullyReplicated, type: <type 'unicode'>, valid types: <type 'dict'>
make: *** [train] Error 255
错误发生在--input-data-config
标志上。我正在尝试使用速记语法,因此我可以注入一些变量(大写单词)。 Haalp!
答案 0 :(得分:0)
因此,您的输入配置格式不正确。 在此处签出样本json: https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html
# look at the format of input-data-config, it is a dictionary
"InputDataConfig": [
{
"ChannelName": "string",
"CompressionType": "string",
"ContentType": "string",
"DataSource": {
"FileSystemDataSource": {
"DirectoryPath": "string",
"FileSystemAccessMode": "string",
"FileSystemId": "string",
"FileSystemType": "string"
},
"S3DataSource": {
"AttributeNames": [ "string" ],
"S3DataDistributionType": "string",
"S3DataType": "string",
"S3Uri": "string"
}
},
"InputMode": "string",
"RecordWrapperType": "string",
"ShuffleConfig": {
"Seed": number
}
}
]