twosixlabs / armory

ARMORY Adversarial Robustness Evaluation Test Bed
MIT License
174 stars 67 forks source link

[BUG]: np.object is deprecated #1971

Closed swsuggs closed 1 year ago

swsuggs commented 1 year ago

Description of the bug

If numpy is numpy-1.24.3, or presumably higher, Armory errors out by calling np.object

File "/home/sterling.suggs/git/twosixlabs/armory/armory/data/datasets.py", line 701, in canonical_variable_image_preprocess
    if batch.dtype == np.object:
       │     │        └ <module 'numpy' from '/home/anaconda/anaconda/conda_envs/sterling.suggs/dw/lib/python3.11/site-packages/numpy/__init__.py'>
       │     └ <attribute 'dtype' of 'numpy.ndarray' objects>
       └ array([[[[ 23,  26,  35],
                  [ 24,  28,  37],
                  [ 31,  40,  47],
                  ...,
                  [ 99,  81,  59],
                ...

  File "/home/anaconda/anaconda/conda_envs/sterling.suggs/dw/lib/python3.11/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
                         │                └ 'object'
                         └ {'object': "module 'numpy' has no attribute 'object'.\n`np.object` was a deprecated alias for the builtin `object`. To avoid ...

AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. 
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

Looks like we use this in two other places: sweep.py, and datasets.py L708 (besides datasets.py L701 as shown above)

Steps To Reproduce

Run a config with --interactive and update numpy in the container

Additional Information

No response

swsuggs commented 1 year ago

Fixed in #1974