-
-
Save yashkumaratri/8f6c7966d1db0df1e87a0e3451707ffd to your computer and use it in GitHub Desktop.
Keras + Universal Sentence Encoder = Transfer Learning for text data | DLology
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import tensorflow_hub as hub | |
module_url = "https://tfhub.dev/google/universal-sentence-encoder-large/3" | |
# Import the Universal Sentence Encoder's TF Hub module | |
embed = hub.Module(module_url) | |
# Compute a representation for each message, showing various lengths supported. | |
messages = ["That band rocks!", "That song is really cool."] | |
with tf.Session() as session: | |
session.run([tf.global_variables_initializer(), tf.tables_initializer()]) | |
message_embeddings = session.run(embed(messages)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment