4

I am trying to serve a prediction using google cloud ml engine. I generated my model using fast-style-transfer and saved it on my google cloud ml engine's models section. For input it use float32 and so I had to convert my image in this format.

image = tf.image.convert_image_dtype(im, dtypes.float32)
matrix_test = image.eval()

Then I generated my json file for the request:

js = json.dumps({"image": matrix_test.tolist()})

Using the following code:

gcloud ml-engine predict --model {model-name} --json-instances request.json

The following error is returned:

ERROR: (gcloud.ml-engine.predict) HTTP request failed. Response: {
  "error": {
    "code": 400,
    "message": "Request payload size exceeds the limit: 1572864 bytes.",
    "status": "INVALID_ARGUMENT"
  }
} 

I would like to know if I can increment this limit and, if not, if there is a way to fix it with a workaround... thanks in advance!

2 Answers2

2

This is a hard limit for the Cloud Machine Learning Engine API. There's a feature request to increase this limit. You could post a comment there asking for an update. Moreover, you could try the following solution in the meantime.

Hope it helps

F10
  • 2,843
  • 2
  • 12
  • 18
1

If you use the batch prediction, you can make predictions on images that exceed that limit.

Here is the official documentation on that: https://cloud.google.com/ml-engine/docs/tensorflow/batch-predict

I hope this helps you in some way!

Sharif Elfouly
  • 508
  • 5
  • 10