【发布时间】:2021-01-02 17:21:12
【问题描述】:
这是使用 EMLo 获取嵌入的代码。
import tensorflow_hub as hub
import tensorflow as tf
elmo = hub.Module("https://tfhub.dev/google/elmo/2")
x = ["Roasted ants are a popular snack in Columbia"]
embeddings = elmo(x, signature="default", as_dict=True)["elmo"] # To Extract ELMo features
embeddings.shape
我收到了这种类型的错误,type error : pruned(text): expected argument #0(zero-based) to be a Tensor; got list (['Roasted ants are a popular snack in Columbia'])。
【问题讨论】:
-
我在我的电脑上尝试了代码,它运行正常。请提供有关错误及其生成位置的更多信息?
-
@madhurika:你能解决这个问题吗?如果是,你能分享一下解决步骤吗?
-
查看tensorflow版本,你用的是>2.0吗?
-
@madhurika:我收到了同样的错误。如果找到解决方案,您有机会发布吗?
标签: python tensorflow