I have a problem with loading pretrained module for an NLP task and the problem is because of the tf migration I suppose. Tensorflow website says that the problem might be sorted if the signature variable is given correctly. Can you help me correct this code ?

TypeError: 'AutoTrackable' object is not callable


import tensorflow_hub as hub
# enabling the pretrained model for trainig our custom model using tensorflow hub
module_url = "https://tfhub.dev/google/universal-sentence-encoder-large/3"
embed = hub.load(module_url)

# creating a method for embedding and will using method for every input layer 
def UniversalEmbedding(x):
    return embed(tf.squeeze(tf.cast(x, tf.string)), signature='default', as_dict=True)["default"]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.