0

I am trying to do an embedding process for a paragraph, the process is called 'Universal Sentence Encoding' from google. This needs to be done for a deep-learning classification process. which gives me the following error:

DAN U-S-E model (Google):

module_url = "https://tfhub.dev/google/universal-sentence-encoder/2"

embed = hub.Module(module_url)

with tf.Session() as session:
  session.run([tf.global_variables_initializer(), tf.tables_initializer()])
  message_embeddings = session.run(embed(train_clean_sentences))

ERROR: ~\AppData\Local\Continuum\anaconda3\lib\site- packages\tensorflow_hub\tensor_info.py in_convert_to_compatible_tensor(value,target, error_prefix)
117 tensor = tf.convert_to_tensor_or_indexed_slices(value, target.dtype)
118 except TypeError as e:
--> 119 raise TypeError("%s: %s" % (error_prefix, e))
120 if _is_sparse(tensor) != _is_sparse(target):
121 if _is_sparse(tensor):

TypeError: Can't convert 'text': data type not understood

I am not sure about what the error is, Any help on this is appreciated!

Community
  • 1
  • 1
Arav
  • 143
  • 1
  • 1
  • 10

1 Answers1

0

In the Above code (in the question), the 'train_clean_sentences' input was a pandas.series data type, as it was a pandas data frame column. The embedding code works once I converted the pandas.series data type to list.

train_clean_sentences = df['Cleansed_X'].tolist()
Arav
  • 143
  • 1
  • 1
  • 10