AttributeError: module ‘numpy‘ has no attribute ‘bool‘.

打印 上一主题 下一主题

主题 764|帖子 764|积分 2292

问题:
Traceback (most recent call last):
  File "main.py", line 278, in <module>
    datasets = data_loader.load_data(config)
  File "/home/user/jie/myStudy/CasEE/OneEE_duee_deleteArgument/data_loader.py", line 330, in load_data
    train_dataset = RelationDataset(*process_bert(train_data, tokenizer, vocab))
  File "/home/user/jie/myStudy/CasEE/OneEE_duee_deleteArgument/data_loader.py", line 216, in process_bert
    _word_mask2d = np.triu(np.ones((length, length), dtype=np.bool))
  File "/home/user/miniconda3/envs/jie_OneEE/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

解决方法:
更换numpy版本或者将代码中出现的np.bool换成np.bool_即可解决

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

玛卡巴卡的卡巴卡玛

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表