标题: 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