From 804803bfc0c0f1b86d3e21ef266e8d4efebbf4fb Mon Sep 17 00:00:00 2001 From: Jake Lepere Date: Mon, 23 Feb 2026 12:03:08 -0800 Subject: [PATCH 1/2] `fasttext`: `np.array(..., copy=False)` -> `np.asarray(...)`. This fixed errors like: ``` E ValueError: Unable to avoid copy while creating an array as requested. E 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). E For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword. ``` See [1]. [1] https://github.com/Everlaw/servers/pull/49616#issuecomment-3947006167 --- python/fasttext_module/fasttext/FastText.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/fasttext_module/fasttext/FastText.py b/python/fasttext_module/fasttext/FastText.py index 21ecb028a..85964e87f 100644 --- a/python/fasttext_module/fasttext/FastText.py +++ b/python/fasttext_module/fasttext/FastText.py @@ -38,7 +38,7 @@ def score_vs_true(self, label): else: y_scores, y_true = ([], ()) - return np.array(y_scores, copy=False), np.array(y_true, copy=False) + return np.asarray(y_scores), np.asarray(y_true) def precision_recall_curve(self, label=None): """Return precision/recall curve""" @@ -53,7 +53,7 @@ def precision_recall_curve(self, label=None): else: precision, recall = ([], ()) - return np.array(precision, copy=False), np.array(recall, copy=False) + return np.asarray(precision), np.asarray(recall) def precision_at_recall(self, recall, label=None): """Return precision for a given recall""" @@ -236,7 +236,7 @@ def check(entry): else: probs, labels = ([], ()) - return labels, np.array(probs, copy=False) + return labels, np.asarray(probs) def get_input_matrix(self): """ From 006fcef85911afce508458cb84f62b468ffd2d0a Mon Sep 17 00:00:00 2001 From: Jake Lepere Date: Mon, 23 Feb 2026 11:27:05 -0800 Subject: [PATCH 2/2] `fasttext`: Bump version. The hope is that this'll build a new wheel with a later version of `numpy`. See [1] for more details. [1] https://github.com/Everlaw/servers/pull/49616#issuecomment-3946788246 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fc0057a46..06f5a4153 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ import platform import io -__version__ = "0.9.4" +__version__ = "0.9.5" FASTTEXT_SRC = "src" # Based on https://github.com/pybind/python_example