使用REST API,我已经训练并部署了一个我现在想要用于预测的模型。我已经defined the collections用于预测输入和输出,并将json文件formatted accordingly上传到云存储。但是,在尝试create a prediction job时,我无法确定要用于dataFormat
字段的值,这是必需参数。有没有办法列出所有有效值?
我的请求如下所示。我已经尝试了JSON
,NEWLINE_DELIMITED_JSON
(就像将数据导入BigQuery时一样),甚至是json mime类型application/json
,在我能想到的几乎所有不同情况下(上层)并且与蛇,骆驼等结合起来。)。
{
"jobId": "my_predictions_123",
"predictionInput": {
"modelName": "projects/myproject/models/mymodel",
"inputPaths": [
"gs://model-bucket/data/testset.json"
],
"outputPath": "gs://model-bucket/predictions/0/",
"region": "us-central1",
"dataFormat": "JSON"
},
"predictionOutput": {
"outputPath": "gs://my-bucket/predictions/1/"
}
}
我的所有尝试都只是让我回来了:
{
"error": {
"code": 400,
"message": "Invalid value at 'job.prediction_input.data_format' (TYPE_ENUM), \"JSON\"",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "job.prediction_input.data_format",
"description": "Invalid value at 'job.prediction_input.data_format' (TYPE_ENUM), \"JSON\""
}
]
}
]
}
}
答案 0 :(得分:1)
从Cloud ML API参考文档https://cloud.google.com/ml/reference/rest/v1beta1/projects.jobs#DataFormat,请求中的数据格式字段应为" TEXT"对于所有文本输入(包括JSON,CSV等)。