Why does online prediction fail with "Unable to get element from the feed as bytes"?
Asked Answered
T

1

3

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()
Taxaceous answered 31/10, 2016 at 10:9 Comment(0)
T
3

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".

Taxaceous answered 31/10, 2016 at 10:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.