Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve the "AttributeError: module 'numpy' has no attribute 'bool8'. D… #2155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

houjibofa2050
Copy link

run run_recbole.py two errors occurred

  1. AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?
  2. raceback (most recent call last):
    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 in torch.load from False to True. Re-running torch.load with weights_only set to False 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 149

Check 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

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant