使用TensorFlow集线器时范围变量出错 [英] Error on Scope Variable While Using Tensorflow Hub
本文介绍了使用TensorFlow集线器时范围变量出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Colab运行文本分析代码。我想从TensorFlow_Hub获取universal-sentence-encoder-large。 但任何时候运行包含以下代码的挡路:
module = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-large/3")
我收到此错误:
RuntimeError: variable_scope module_8/ was unused but the
corresponding name_scope was already taken.
如果您知道如何修复此错误,我将不胜感激?
推荐答案
TF Hub USE-3 Module不适用于TensorFlow2.0版。
因此,如果您将版本从2.0更改为1.15,则可以正常工作,不会出现任何错误。
请查找下面提到的工作代码:
!pip install tensorflow==1.15
!pip install "tensorflow_hub>=0.6.0"
!pip3 install tensorflow_text==1.15
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
import tensorflow_text
module = hub.Module("https://tfhub.dev/google/universal-sentence-encoder-large/3")
请同时查找Google Colab的Github Gist。
这篇关于使用TensorFlow集线器时范围变量出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文