Issue
I am really new to tensorflow and I am trying to figure out how to load a SavedModel downloaded from TFHub as a Keras model.
I downloaded a SavedModel from https://tfhub.dev/google/LaBSE/2. I was able to load the model in my code using tf.saved_model.load()
. However, when I tried to load the model using tf.keras.models.load_model
, I got the following error
IndexError: list index (0) out of range
And idea how i can load or convert the model to a Keras model?
Thanks!
Solution
Have you checked the Example Use part in the Hub? Are the example codes there working for you? Please try the below snippet for loading the model directly from the Hub:
hub.KerasLayer("https://tfhub.dev/google/LaBSE/2")
Because yours is a Hub model, the above line should work for you.
However, if you'd like to directly convert the SavedModel (.pb) into a Keras model, then please check here.
Answered By - momo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.