Skip to content

AttributeError: module 'numpy' has no attribute 'float'. #68

@undercover87

Description

@undercover87

Hello and thank you for the hard work on this repo.
I am trying to launch an lf attack and I am getting the aforementioned error (see below for full traceback)
I am running the experiment on WSL with Ubuntu 24.04 and a virtualenv with python 3.8.
pip freeze says numpy is 1.24

Do you want a PR for changing this to np.float64 as the error message suggests? There is another occurence in the same file some lines below but I didn't search for occurences in other files as well.

Traceback (most recent call last):
File "./attack/lf.py", line 93, in
attack.stage1_non_training_data_prepare()
File "/home/bellas/sources/BackdoorBench/./attack/badnet.py", line 128, in stage1_non_training_data_prepare
train_bd_img_transform, test_bd_img_transform = bd_attack_img_trans_generate(args)
File "/home/bellas/sources/BackdoorBench/./utils/aggregate_block/bd_attack_generate.py", line 195, in bd_attack_img_trans_generate
(SimpleAdditiveTrigger(
File "/home/bellas/sources/BackdoorBench/./utils/bd_img_transform/patch.py", line 56, in init
self.trigger_array = trigger_array.astype(np.float)
File "/home/bellas/sources/BackdoorBench/.bd_bench_venv/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'float'.
np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions