Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prediction via Cloud ML not working #13

Closed
emilwidlund opened this issue Jul 21, 2018 · 1 comment
Closed

Prediction via Cloud ML not working #13

emilwidlund opened this issue Jul 21, 2018 · 1 comment

Comments

@emilwidlund
Copy link

emilwidlund commented Jul 21, 2018

I'm trying to run predictions on the model via Google Cloud ML. I'm however getting this error when I execute my request:

{"error":"Prediction failed: Error during model execution: AbortionError(code=StatusCode.INVALID_ARGUMENT, details=\"NodeDef mentions attr 'identical_element_shapes' not in Op<name=TensorArrayV3; signature=size:int32 -> handle:resource, flow:float; attr=dtype:type; attr=element_shape:shape,default=<unknown>; attr=dynamic_size:bool,default=false; attr=clear_after_read:bool,default=true; attr=tensor_array_name:string,default=\"\"; is_stateful=true>; NodeDef: map/TensorArray = TensorArrayV3[_output_shapes=[[2], []], clear_after_read=true, dtype=DT_STRING, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name=\"\", _device=\"/job:localhost/replica:0/task:0/cpu:0\"](map/strided_slice)\n\t [[Node: map/TensorArray = TensorArrayV3[_output_shapes=[[2], []], clear_after_read=true, dtype=DT_STRING, dynamic_size=false, element_shape=<unknown>, identical_element_shapes=true, tensor_array_name=\"\", _device=\"/job:localhost/replica:0/task:0/cpu:0\"](map/strided_slice)]]\")"}

I've exported the saved model via the tool and it deployed successfully in the Google Cloud Console.

Here is the relevant part of my code:

        # ...
       temp_base64 = base64.b64encode(temp.getvalue())

        model_name = 'projects/{}/models/{}'.format('glotter-80ac0', 'NSFW')

        ml = discovery.build('ml', 'v1')

        requestDict = {
            "instances": [{
                "b64": temp_base64.decode('utf-8')
            }]
        }

        mlRequest = ml.projects().predict(name=model_name, body=requestDict)

        try:
            response = mlRequest.execute()
            return jsonify(response)
        except errors.HttpError:
            print('There was an error creating the model. Check the details:')
            print(errors.HttpError._get_reason())
@mdietrichstein
Copy link
Owner

I've exported the saved model via the tool and it deployed successfully in the Google Cloud Console.

That means you've used tools/export_savedmodel.py, correct?

The error message indicates that cloud ml has problems loading the model due to some unknown ops/attributes. Does your ML engine environment use the same tensorflow version that you've used to export the model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants