Skip to content

update np.float to np.float64#1713

Open
ElkanaBaris wants to merge 1 commit intoRUCAIBox:masterfrom
ElkanaBaris:patch-1
Open

update np.float to np.float64#1713
ElkanaBaris wants to merge 1 commit intoRUCAIBox:masterfrom
ElkanaBaris:patch-1

Conversation

@ElkanaBaris
Copy link
Contributor

numpy >= 1.20 doesn't support dtype=np.float, this causes failure when running metrics.py
I updated all np.float to np.float64

  File "/opt/anaconda3/envs/recbole/lib/python3.9/site-packages/recbole/evaluator/metrics.py", line 190, in metric_info
    iranks = np.zeros_like(pos_index, dtype=np.float)
  File "/opt/anaconda3/envs/recbole/lib/python3.9/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

@zhengbw0324
Copy link
Collaborator

Hi @ElkanaBaris, thank you for your attention. In github, we have fix this issue in #1621.

@crazysal
Copy link

Traceback (most recent call last):
File "/home/jupyter/run.py", line 5, in
config = Config(model='SASRec', config_file_list=['df_sep2023may2024_v7_2_100p_gm_train.yaml'])
File "/opt/conda/lib/python3.10/site-packages/recbole/config/configurator.py", line 80, in init
self.compatibility_settings()
File "/opt/conda/lib/python3.10/site-packages/recbole/config/configurator.py", line 630, in compatibility_settings
np.float = np.float_
File "/opt/conda/lib/python3.10/site-packages/numpy/init.py", line 400, in getattr
raise AttributeError(
AttributeError: np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead

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.

3 participants