问题下载预训练的多语言通用句子编码器以进行局部分析

时间:2019-07-25 14:18:08

标签: python tensorflow nlp

我正在尝试下载Google的新型预训练多语言通用句子编码器,该编码器于今年7月发布。我已经在他们的网站上使用Colab跟踪了该测试,并且运行良好,但是当我尝试在本地进行测试时,它在尝试下载时永久挂起(从tf's site复制的代码):

import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
import tf_sentencepiece

# Some texts of different lengths.
english_sentences = ["dog", "Puppies are nice.", "I enjoy taking long walks along the beach with my dog."]
italian_sentences = ["cane", "I cuccioli sono carini.", "Mi piace fare lunghe passeggiate lungo la spiaggia con il mio cane."]
japanese_sentences = ["犬", "子犬はいいです", "私は犬と一緒にビーチを散歩するのが好きです"]

#hangs here:
embed = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-multilingual/1")

我已经安装了所有依赖项和软件包。其他更简单的模型(例如英语句子编码器)也只能在这种新模型中使用。有任何想法吗?谢谢大家!

1 个答案:

答案 0 :(得分:0)

找到并解决了所有感兴趣的人的问题。它似乎是张量流1.14和tf-句子件0.1.82.1之间的兼容性问题。要解决该问题,只需将here中所述的tensorflow 1.14降级到1.13.1,对我来说就可以解决。