使用TensorFlow集线器时范围变量出错

编程入门 行业动态 更新时间:2024-10-26 14:38:07
本文介绍了使用TensorFlow集线器时范围变量出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Colab运行文本分析代码。我想从TensorFlow_Hub获取universal-sentence-encoder-large。 但任何时候运行包含以下代码的挡路:

module = hub.Module("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("tfhub.dev/google/universal-sentence-encoder-large/3")

请同时查找Google Colab的Github Gist。

更多推荐

使用TensorFlow集线器时范围变量出错

本文发布于:2023-07-20 22:06:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1171513.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:集线器   变量   TensorFlow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!