【发布时间】:2018-11-28 14:13:07
【问题描述】:
我正在尝试为一个段落做一个嵌入过程,这个过程被谷歌称为“通用句子编码”。这需要为深度学习分类过程完成。这给了我以下错误:
DAN U-S-E 模型(谷歌):
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))
错误:
~\AppData\Local\Continuum\anaconda3\lib\site-
packages\tensorflow_hub\tensor_info.py in_convert_to_compatible_tensor(value,target, error_prefix)
117 张量 = tf.convert_to_tensor_or_indexed_slices(值,target.dtype)
118 除了 TypeError 作为 e:
--> 119 引发 TypeError("%s: %s" % (error_prefix, e))
120 如果 _is_sparse(张量)!= _is_sparse(目标):
121如果_is_sparse(张量):
TypeError:无法转换“文本”:无法理解数据类型
我不确定错误是什么,感谢任何帮助!
【问题讨论】:
标签: python encoding word-embedding sentence python-embedding