Solve the "AttributeError: module 'numpy' has no attribute 'bool8'. D…#2155
Open
houjibofa2050 wants to merge 1 commit intoRUCAIBox:masterfrom
Open
Conversation
…id you mean: 'bool'?" problem caused by the high version of numpy and Solve the problem caused by the change of the default value of the weights_only parameter in PyTorch 2.6 version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_onlyargument intorch.loadfromFalsetoTrue. Re-runningtorch.loadwithweights_onlyset toFalsewill 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=Truecompatible 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