问题
Online prediction is failing with "Unable to get elements from the feed as bytes". What does this mean and how can I fix it?
I'm generating predictions using the following code:
request_data = [{ 'examples' :
{'pickup_longitude': -73.885262,
'pickup_latitude': 40.773008,
'dropoff_longitude': -73.987232,
'dropoff_latitude': 40.732403,
'fare_amount': 0,
'passenger_count': 2}}]
parent = 'projects/%s/models/%s/versions/%s' % ('some project', 'taxifare', 'v1')
response = api.projects().predict(body={'instances': request_data}, name=parent).execute()
回答1:
The problem was that I didn't include a metadata file as part of the model. The metadata file tells the Cloud ML service how to convert json records to serialized example protos. Without the metadata file, conversion won't take place and as a result tf.parse_example will fail with the error "Unable to get element from the feed as bytes".
来源:https://stackoverflow.com/questions/40340102/why-does-online-prediction-fail-with-unable-to-get-element-from-the-feed-as-byt