Closed myhloli closed 2 months ago
An issue was identified in the fast_langdetect
library where the FastText model was incompatible with NumPy versions greater than or equal to 2.0.0. The specific error encountered was:
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
The detected incompatibility caused the unit test test_detect_totally
to fail when attempting to detect language using the FastText model, due to changes in NumPy 2.0.0's handling of array creation.
The error occurred because FastText used np.array
with the copy=False
parameter, which is not supported in NumPy 2.0.0 as per the migration guide. This made the code incompatible with newer versions of NumPy.
To resolve the incompatibility, the project's requirements were updated to restrict the version of NumPy to less than 2.0.0. Specifically, the following change was made to the requirements.txt
file:
numpy>=1.26.4,<2.0.0
This adjustment ensures that the project remains compatible with NumPy versions that do not introduce the breaking change.
The issue was successfully resolved by the contributor @sudoskys. The project's requirements now specify an appropriate range for the NumPy version, avoiding the incompatibility with NumPy 2.0.0 and ensuring stable functionality for fast_langdetect
.
We extend our gratitude to @sudoskys for promptly addressing this issue and providing a solution. The community's swift action ensures the continued reliability and performance of the fast_langdetect
library.
Report Prepared By:
LlmKira Contributors
https://github.com/facebookresearch/fastText has been archived, I just add "numpy<2.0.0" in my requirements.txt.