预测时,dataFormat 的有效值是多少?

When predicting, what are the valid values for dataFormat?

问题

使用 REST API,我训练并部署了一个模型,现在我想将其用于预测。我 defined the collections for prediction input and output and uploaded a json file formatted accordingly to the cloud storage. However, when trying to create a prediction job 我不知道要为 dataFormat 字段使用什么值,这是一个必需的参数。有没有办法列出所有有效值?

我试过的

我的请求如下所示。我试过 JSONNEWLINE_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\""
          }
        ]
      }
    ]
  }
}

来自 Cloud ML API 参考文档 https://cloud.google.com/ml/reference/rest/v1beta1/projects.jobs#DataFormat,对于所有文本输入(包括 JSON、CSV 等),您请求中的数据格式字段应为 "TEXT" ).