Google explainable ai 429 错误流量超出服务容量。减少流量或减小模型的大小

Google explainable ai 429 error Rate of traffic exceeds serving capacity. Decrease your traffic or reduce the size of your model

我正在尝试使用 Google 的可解释 ai 来解释图像预测模型,但出现 429 错误。我要解读的模型是使用mobilenet v3大模型,应用迁移学习的模型。

python代码:

ig_response = remote_ig_model.explain(instances)

结果:

ValueError: Target URI https://asia-northeast1-        ml.googleapis.com/v1/projects/cellimaging/models/A549_4/versions/v_ig_4:explain returns     HTTP 429 error.
Please check the raw error message: 
{
  "error": {
    "code": 429,
    "message": "Rate of traffic exceeds serving capacity. Decrease your traffic or reduce the size of your model: projects/842842301933/models/A549_4/versions/v_ig_4.",
    "status": "RESOURCE_EXHAUSTED"
  }
}

使用ai-platform创建服务模型时,命令如下

代码:

! gcloud beta ai-platform versions create $IG_VERSION --region='asia-northeast1' \
--model $MODEL \
--origin $export_path \
--runtime-version 2.2 \
--framework TENSORFLOW \
--python-version 3.7 \
--machine-type n1-highcpu-32 \
--explanation-method integrated-gradients \
--num-integral-steps 25

我收到 429 错误并尝试更改机器类型 (n1-standard-4 -> n1-highcpu-32),但错误未解决。

你可以看看这个troubleshoot section,你的请求不能大于1.5Mb

A single online prediction request must contain no more than 1.5 MB of data.

如果您的输入为 1024,1024,3,您的图像大小应为 3Mb(1024 x 1024 x 3 字节),因此对于 API.

来说太大了