我正在使用 Google Auto ML 自然语言 API。
我已经有一个训练有素的模型。
一开始,当我训练模型时,它被部署了,一切都很好。根据谷歌从 2019 年 1 月 22 日起的新规定,7 周或更长时间没有预测流量的模型将被静默地取消部署和归档。
目前,我无法预测该训练模型的任何结果,因为它尚未部署,因为它可能有 7 周未使用。
同样根据谷歌,如果我想继续使用该模型,我应该使用 Deploy API 重新部署它。 https://cloud.google.com/natural-language/automl/docs/models#deploying_or_undeploying_a_model
我尝试重新部署模型,但出现错误,因此无法做出任何预测。
为了开始预测结果,我怎样才能部署一个没有错误的模型?
因此,我将展示我为尝试解决此问题而采取的步骤:
- 使用正确的数据运行部署请求。
- 运行操作请求
- 等待部署完成
- 再次运行操作请求
- 显示我拥有的模型列表(未部署)
1 https://automl.googleapis.com/v1beta1/projects/ {project}/locations/{location}/models/{Model ID}:deploy
{
"name": "projects/{project}/locations/{location}/operations/{Model ID}",
"metadata": {
"@type": "type.googleapis.com/google.cloud.automl.v1beta1.OperationMetadata",
"createTime": {Time},
"updateTime": {Time}
}
}
2 和 4 https://automl.googleapis.com/v1beta1/projects/{project}/locations/{location}/operations
"operations": [
{
"name": "projects/{project}/locations/{location}/operations/{Model ID}",
"metadata": {
"@type": "type.googleapis.com/google.cloud.automl.v1beta1.OperationMetadata",
"createTime": {Time},
"updateTime": "{Time},
"progressPercent": 100
},
"done": true,
"error": {
"code": 4
}
}
]
5 https://automl.googleapis.com/v1beta1/projects/{project}/locations/{location}/models
"model": [
{
"name": "projects/{project}/locations/{location}/models/{Model ID}",
"displayName": {name},
"datasetId": {dataset id},
"createTime": {time},
"deploymentState": "UNDEPLOYED",
"updateTime": {time},
"textClassificationModelMetadata": {}
}
]
因此,当模型完成部署进度时,我期望操作请求中出现 0 个错误,但它显示错误代码 4。我在此提供的枚举中搜索了此错误代码 4:https ://github.com/googleapis/googleapis /blob/master/google/rpc/code.proto
对于错误代码 4:
// The deadline expired before the operation could complete. For operations
// that change the state of the system, this error may be returned
// even if the operation has completed successfully. For example, a
// successful response from a server could have been delayed long
// enough for the deadline to expire.
//
// HTTP Mapping: 504 Gateway Timeout
DEADLINE_EXCEEDED = 4;
我不知道为什么会发生这种超时。
我已经在配额限制中搜索,但一切都很好。