未指定版本,并且未找到模型的默认版本

时间:2018-01-26 05:02:29

标签: google-cloud-ml

我将我的预测模型上传到Googles的ML Engine。我跑的时候

gcloud ml-engine predict --model=earnings --json-instances=sample_input_prescaled.json

我收到错误

ERROR: (gcloud.ml-engine.predict) HTTP request failed. Response: {
  "error": {
"code": 400,
"message": "Field: name Error: No version was specified and no default version for the model was found.",
"status": "INVALID_ARGUMENT",
"details": [
  {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "field": "name",
        "description": "No version was specified and no default version for the model was found."
      }
    ]
  }
]
  }
}

如何在模型中添加版本?

1 个答案:

答案 0 :(得分:1)

如果您使用Web界面启动模型,则可以向模型添加版本。那是ML Engine > Models > [model name] > Create a version

Google ML Engine interface

还要确保您的变量文件仍在存储桶的variables目录中。当我将模型复制到(gsutil cp -R exported_model/* gs://keras-class-191806/earnings_v1)时,模型的目录结构被展平。恢复变量文件夹并移动变量文件。