从Tensorflow预训练的嵌入中获取词汇表

时间:2020-05-29 01:27:56

标签: tensorflow tensorflow-datasets

我现在正将此https://tfhub.dev/google/Wiki-words-500/2用作预训练的嵌入。对于我的应用程序(文本生成),我有兴趣获取词汇表中的标记列表。我知道它的大小为1009375。但是我似乎无法获取列表。我知道它已加载到内存中,但我似乎找不到。有人知道吗?

1 个答案:

答案 0 :(得分:1)

google/Wiki-words-500/2 模型的默认缓存位置是 /tmp/tfhub_modules/bf115a5fe517f019bebae05b433eaeee6415f5bf (more on caching)。您将在 assets 目录中找到该文件,其中包含辅助文件:

wc -l /tmp/tfhub_modules/bf115a5fe517f019bebae05b433eaeee6415f5bf/assets/tokens.txt
> 1009374