You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
Minor fix for TensorFlow 2.0.0 or greater users
import tensorflow as tf
if int(tf.version[0]) > 1:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
plot_emb_list = []
with tf.Graph().as_default():
embed = hub.Module("https://tfhub.dev/google/universal-sentence-encoder/2")
messages = tf.placeholder(dtype=tf.string, shape=[None])
output = embed(messages)
with tf.Session() as session:
session.run([tf.global_variables_initializer(), tf.tables_initializer()])
for plot in tqdm_notebook(df['Plot']):
sent_list = sent_tokenize(plot)
clean_sent_list = clean_plot(sent_list)
sent_embed = session.run(output, feed_dict={messages: clean_sent_list})
plot_emb_list.append(sent_embed.mean(axis=0).reshape(1,512))
The text was updated successfully, but these errors were encountered: