0

我想从这里链接尝试通用句子编码器

这是我在 Ubuntu 18.04 和 Jupyter Notebook 上运行的代码

import tensorflow as tf
import tensorflow_hub as hub
embed = hub.Module("https://tfhub.dev/google/universal-sentence-encoder/2")
embeddings = embed([
    "The quick brown fox jumps over the lazy dog.",
    "I am a sentence for which I would like to get its embedding"])

print(session.run(embeddings))

它只是继续运行,没有任何事情发生。是不是在下载东西?我已经等了很长时间了。除了以下内容,它不显示任何内容:

WARNING: Logging before flag parsing goes to stderr.
W0517 09:23:47.724080 139743818422080 __init__.py:56] Some hub symbols are not available because TensorFlow version is less than 1.14

我检查了我的 tensorflow 安装。看起来不错。有任何故障排除建议吗?

4

1 回答 1

1

你很好。此错误消息涉及仅对在 TensorFlow 2 中使用 TF Hub 重要的符号,尤其是 hub.KerasLayer。已建立的 TF1.x 用法工作得很好。

代码已经提交(但还没有被常规的 Hub 版本接收)以切换到不那么令人担忧的措辞。对困惑感到抱歉。

于 2019-05-24T09:13:15.157 回答