首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试访问bert.variables时获得BERT模块错误

尝试访问bert.variables时获得BERT模块错误
EN

Stack Overflow用户
提问于 2019-06-27 23:26:27
回答 1查看 105关注 0票数 0

我正在尝试让BERT从这里获得的代码中进行情感分析:https://github.com/strongio/keras-bert

但是当我尝试建立模型时,我得到了一个错误,

代码语言:javascript
复制
'Module' object has no attribute 'variables'

当我试图访问self.bert.variables时,这种情况特别发生在BertLayer类的构建函数中。

我尝试使用dir(self.bert)来获取对象的所有属性,但它确实没有一个名为variables的属性。以下是我获得的属性:

代码语言:javascript
复制
['\__call__', '\__class__', '\__delattr__', '\__dict__', '\__dir__', '\__doc__', '\__eq__', '\__format__', '\__ge__', '\__getattribute__', '\__gt__', '\__hash__', '\__init__', '\__init_subclass__', '\__le__', '\__lt__', '\__module__', '\__ne__', '\__new__', '\__reduce__', '\__reduce_ex__', '\__repr__', '\__setattr__', '\__sizeof__', '\__str__', '\__subclasshook__', '\__weakref__', '_graph', '_impl', '_name', '_spec', '_tags', '_trainable', 'export', 'get_input_info_dict', 'get_output_info_dict', 'get_signature_names', 'variable_map']

我正在使用tf版本: 1.13.0和Python: 3.5

EN

回答 1

Stack Overflow用户

发布于 2019-06-28 02:13:50

安装最新版本的tensorflow和tensorflow集线器解决了此问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56794341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档