Solve the "AttributeError: module 'numpy' has no attribute 'bool8'. D… #2155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
run run_recbole.py two errors occurred
File "D:\recbole_pr\RecBole-1.2.1\RecBole-1.2.1\run_recbole.py", line 46, in
run(
File "D:\recbole_pr\RecBole-1.2.1\RecBole-1.2.1\recbole\quick_start\quick_start.py", line 52, in run
res = run_recbole(
File "D:\recbole_pr\RecBole-1.2.1\RecBole-1.2.1\recbole\quick_start\quick_start.py", line 153, in run_recbole
test_result = trainer.evaluate(
File "C:\Users\cm.conda\envs\RecBole\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "D:\recbole_pr\RecBole-1.2.1\RecBole-1.2.1\recbole\trainer\trainer.py", line 583, in evaluate
checkpoint = torch.load(checkpoint_file, map_location=self.device)
File "C:\Users\cm.conda\envs\RecBole\lib\site-packages\torch\serialization.py", line 1470, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. In PyTorch 2.6, we changed the default value of the
weights_only
argument intorch.load
fromFalse
toTrue
. Re-runningtorch.load
withweights_only
set toFalse
will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.Please file an issue with the following so that we can make
weights_only=True
compatible with your use case: WeightsUnpickler error: Unsupported operand 149Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
Solution
The purpose is to solve these two errors,
modify the numpy version and specify the value corresponding to weights_only to be false