\#3526: address numpy 2 upgrade

This commit is contained in:
Amir Sadoughi 2025-02-07 15:28:24 -08:00
parent aff6bfcd80
commit f04424c9f6
7 changed files with 22 additions and 17 deletions

View File

@ -39,7 +39,7 @@ runs:
conda update -y -q conda
echo "$CONDA/bin" >> $GITHUB_PATH
conda install -y -q python=3.11 cmake=3.26 make=4.2 swig=4.0 "numpy<2" scipy=1.14 pytest=7.4 gflags=2.2
conda install -c conda-forge -y -q python=3.11 cmake=3.26 make=4.2 swig=4.0 numpy scipy=1.14 pytest=7.4 gflags=2.2
# install base packages for ARM64
if [ "${{ runner.arch }}" = "ARM64" ]; then

View File

@ -106,17 +106,17 @@ outputs:
host:
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- {{ pin_subpackage('libfaiss', exact=True) }}
run:
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- packaging
- {{ pin_subpackage('libfaiss', exact=True) }}
test:
requires:
- numpy >=1.19,<2
- numpy >=1.19
- scipy
- pytorch <2.5
- pytorch-cuda {{ cuda_constraints }}

View File

@ -91,17 +91,17 @@ outputs:
- cuda-toolkit {{ cudatoolkit }}
host:
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win]
- {{ pin_subpackage('libfaiss', exact=True) }}
run:
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- packaging
- {{ pin_subpackage('libfaiss', exact=True) }}
test:
requires:
- numpy >=1.19,<2
- numpy >=1.19
- scipy
- pytorch <2.5
- pytorch-cuda {{ cuda_constraints }}

View File

@ -115,7 +115,7 @@ outputs:
{% endif %}
host:
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- {{ pin_subpackage('libfaiss', exact=True) }}
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64 and not win]
{% if PY_VER == '3.9' or PY_VER == '3.10' or PY_VER == '3.11' %}
@ -128,7 +128,7 @@ outputs:
{% endif %}
run:
- python {{ python }}
- numpy >=1.19,<2
- numpy >=1.19
- packaging
- {{ pin_subpackage('libfaiss', exact=True) }}
{% if PY_VER == '3.9' or PY_VER == '3.10' or PY_VER == '3.11' %}
@ -141,7 +141,7 @@ outputs:
{% endif %}
test:
requires:
- numpy >=1.19,<2
- numpy >=1.19
- scipy
- pytorch <2.5
{% if PY_VER == '3.9' or PY_VER == '3.10' or PY_VER == '3.11' %}

View File

@ -45,11 +45,15 @@ def supported_instruction_sets():
import numpy
if Version(numpy.__version__) >= Version("1.19"):
# use private API as next-best thing until numpy/numpy#18058 is solved
from numpy.core._multiarray_umath import __cpu_features__
# __cpu_features__ is a dictionary with CPU features
# as keys, and True / False as values
supported = {k for k, v in __cpu_features__.items() if v}
supported = {}
if hasattr(numpy, 'show_config'):
supported = set(numpy.show_config('dicts')['SIMD Extensions']['found'])
else:
# use private API as next-best thing until numpy/numpy#18058 is solved
from numpy.core._multiarray_umath import __cpu_features__
# __cpu_features__ is a dictionary with CPU features
# as keys, and True / False as values
supported = {k for k, v in __cpu_features__.items() if v}
if is_sve_supported():
supported.add("SVE")
for f in os.getenv("FAISS_DISABLE_CPU_FEATURES", "").split(", \t\n\r"):

View File

@ -30,6 +30,7 @@ class TestPCA(unittest.TestCase):
prev = 1e50
for o in column_norm2:
o = float(o)
self.assertGreater(prev, o)
prev = o

View File

@ -385,7 +385,7 @@ class TestPreassigned(unittest.TestCase):
D, I = ivf_tools.search_preassigned(index, xq, 4, a)
radius = D.max() * 1.01
lims, DR, IR = ivf_tools.range_search_preassigned(index, xq, radius, a)
lims, DR, IR = ivf_tools.range_search_preassigned(index, xq, float(radius), a)
# with that radius the k-NN results are a subset of the range search
# results
@ -586,7 +586,7 @@ class TestClustering(unittest.TestCase):
# normally 47 / 200 differences
ndiff = (Iref != Inew).sum()
self.assertLess(ndiff, 53)
self.assertLess(ndiff, 56)
class TestBigBatchSearch(unittest.TestCase):