Skip to content

Fix NumPy 1.24+ compatibility: replace deprecated np.float#5645

Open
Mr-Neutr0n wants to merge 2 commits intofacebookresearch:mainfrom
Mr-Neutr0n:fix/numpy-deprecation
Open

Fix NumPy 1.24+ compatibility: replace deprecated np.float#5645
Mr-Neutr0n wants to merge 2 commits intofacebookresearch:mainfrom
Mr-Neutr0n:fix/numpy-deprecation

Conversation

@Mr-Neutr0n
Copy link

Summary

  • Replace deprecated NumPy float aliases to support NumPy 1.24+

Changes

  • fairseq/modules/dynamic_crf_layer.py: Replace np.float("inf") with float("inf")
  • examples/data2vec/models/mae.py: Replace np.float with np.float64

Background

np.float was deprecated in NumPy 1.20 and removed in NumPy 1.24. Using np.float now raises AttributeError: module 'numpy' has no attribute 'float'.

Test plan

  • Verified the fix maintains the same behavior
  • float("inf") is the correct way to represent infinity
  • np.float64 maintains the same precision as the original np.float

Fixes #4945

🤖 Generated with Claude Code

- Replace np.float("inf") with float("inf") in dynamic_crf_layer.py
- Replace np.float with np.float64 in mae.py

np.float was deprecated in NumPy 1.20 and removed in NumPy 1.24.

Fixes facebookresearch#4945

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@meta-cla
Copy link

meta-cla bot commented Feb 5, 2026

Hi @Mr-Neutr0n!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not compatible with numpy >= 1.24.0

1 participant