问题
使用RESTneneneba API,我已经训练并部署了一个模型,现在我想将其用于预测。我已经定义了预测输入和输出的集合,并上传了一个相应格式化的json文件到云存储。然而,当尝试创建预测作业时,我无法确定dataFormat
字段的值,这是一个必需的参数。有没有办法列出所有有效值?
我尝试过的
我的请求如下。我已经尝试过JSON
、NEWLINE_DELIMITED_JSON
(就像将数据导入BigQuery时一样(,甚至json-mime类型的application/json
,在我能想到的几乎所有不同的情况下(上下结合snake、camel等(
{
"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""
}
]
}
]
}
}
来自Cloud ML API参考文档https://cloud.google.com/ml/reference/rest/v1beta1/projects.jobs#DataFormat,对于所有文本输入(包括JSON、CSV等(,请求中的数据格式字段应为"TEXT"。