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

Need hash_func for type google.protobuf.pyext._message.RepeatedScalarContainer #1186

Open
tc87 opened this issue Mar 6, 2020 · 7 comments
Open

Comments

@tc87
Copy link

@tc87 tc87 commented Mar 6, 2020

Summary

A community member noticed a "cannot hash of type" issue. More information can be found in this forum discussion.

Full error message

This is the error the community member received:UnhashableType: Cannot hash object of type google.protobuf.pyext._message.RepeatedScalarContainer

@tc87

This comment has been minimized.

Copy link
Author

@tc87 tc87 commented Mar 6, 2020

More context from forum user Snertie:

"I’m having an issue with caching a loaded tensorflow hub model. I get an UnhashableType error on the type ‘google.protobuf.pyext._message.RepeatedScalarContainer’. The error suggest using hash_funcs but I can’t access that type so it doesn’t work. I tried wrapping the model in a custom object and forcing the ‘id’ as hashing function, but this doesn’t work either.

I don’t really know if I’m forgetting something obvious or not. Code sample below:

@st.cache
def get_model():
    return hub.load("https://tfhub.dev/google/universal-sentence-encoder-multilingual-large/3")

And the error I get is:

UnhashableType: Cannot hash object of type google.protobuf.pyext._message.RepeatedScalarContainer

Thanks in advance and keep up the good work!"

@Snertie

This comment has been minimized.

Copy link

@Snertie Snertie commented Mar 9, 2020

Error message:
image

@jrhone

This comment has been minimized.

Copy link
Contributor

@jrhone jrhone commented Mar 17, 2020

import tensorflow_hub as hub

Can also be imported as a keras model

@jrhone

This comment has been minimized.

Copy link
Contributor

@jrhone jrhone commented Mar 18, 2020

Here is tutorial using an example TFHub model: https://www.tensorflow.org/tutorials/images/transfer_learning_with_hub

@jrhone

This comment has been minimized.

Copy link
Contributor

@jrhone jrhone commented Mar 18, 2020

Object of type google.protobuf.pyext._message.RepeatedScalarContainer: ['inputs']
Object of type builtins.tuple: ('_arg_keywords', ['inputs'])
Object of type tensorflow.python.saved_model.load._WrapperFunction:
Object of type tensorflow.python.saved_model.signature_serialization._SignatureMap:
Object of type tensorflow.python.training.tracking.base.TrackableReference:
Object of type tensorflow.python.saved_model.load._UserObject:
@treuille

This comment has been minimized.

Copy link
Collaborator

@treuille treuille commented Mar 31, 2020

@jrhone : Is that the complete object trace? Quick look suggests that the type to write a hash_func for would be for type tensorflow.python.saved_model.load._UserObject, right? Do we know anything about that object?

@jrhone

This comment has been minimized.

Copy link
Contributor

@jrhone jrhone commented Mar 31, 2020

That's the complete trace with the noise removed.

This is the documentation for that object https://www.tensorflow.org/api_docs/python/tf/saved_model/load

@jrhone jrhone added enhancement and removed bug labels Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.