Fix NumPy 1.24+ compatibility: replace deprecated np.float#5645
Fix NumPy 1.24+ compatibility: replace deprecated np.float#5645Mr-Neutr0n wants to merge 2 commits intofacebookresearch:mainfrom
Conversation
- 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>
|
Hi @Mr-Neutr0n! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Summary
Changes
fairseq/modules/dynamic_crf_layer.py: Replacenp.float("inf")withfloat("inf")examples/data2vec/models/mae.py: Replacenp.floatwithnp.float64Background
np.floatwas deprecated in NumPy 1.20 and removed in NumPy 1.24. Usingnp.floatnow raisesAttributeError: module 'numpy' has no attribute 'float'.Test plan
float("inf")is the correct way to represent infinitynp.float64maintains the same precision as the originalnp.floatFixes #4945
🤖 Generated with Claude Code