ToB企服应用市场:ToB评测及商务社交产业平台

标题: AttributeError: module ‘numpy‘ has no attribute ‘bool‘. [打印本页]

作者: 玛卡巴卡的卡巴卡玛    时间: 昨天 00:25
标题: AttributeError: module ‘numpy‘ has no attribute ‘bool‘.
问题:
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企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4