Unverified Commit af6a95b8 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

faiss: 1.9.0 -> 1.10.0 (#378223)

parents e8a1fcd1 77667232
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
  cudaPackages ? { },
  cudaSupport ? config.cudaSupport,
  pythonSupport ? true,
  pythonPackages,
  python3Packages,
  llvmPackages,
  blas,
  swig,
@@ -25,7 +25,7 @@

let
  pname = "faiss";
  version = "1.9.0";
  version = "1.10.0";

  inherit (cudaPackages) flags backendStdenv;

@@ -50,16 +50,9 @@ stdenv.mkDerivation {
    owner = "facebookresearch";
    repo = "faiss";
    tag = "v${version}";
    hash = "sha256-P8TynU6jz5NbcWLdI7n4LX5Gdz0Ks72bmOzQ3LGjQCQ=";
    hash = "sha256-Jws6AW0rj6N/MOoaxK6N7KaPkjCYN47Il0xzyKZ7Wc0=";
  };

  postPatch = lib.optionalString pythonSupport ''
    substituteInPlace faiss/python/loader.py \
      --replace-fail \
      "# platform-dependent legacy fallback using numpy.distutils.cpuinfo" \
      "return False"
  '';

  nativeBuildInputs =
    [ cmake ]
    ++ lib.optionals cudaSupport [
@@ -67,9 +60,9 @@ stdenv.mkDerivation {
      autoAddDriverRunpath
    ]
    ++ lib.optionals pythonSupport [
      pythonPackages.python
      pythonPackages.setuptools
      pythonPackages.pip
      python3Packages.python
      python3Packages.setuptools
      python3Packages.pip
    ];

  buildInputs =
@@ -77,7 +70,7 @@ stdenv.mkDerivation {
      blas
      swig
    ]
    ++ lib.optionals pythonSupport [ pythonPackages.numpy ]
    ++ lib.optionals pythonSupport [ python3Packages.numpy ]
    ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ]
    ++ lib.optionals cudaSupport cudaComponents;

+29 −13
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  embedding-reader,
  faiss,
  fetchFromGitHub,
  fire,
  fsspec,
  lib,
  numpy,
  pyarrow,

  pytestCheckHook,
  pythonOlder,
}:

buildPythonPackage rec {
  pname = "autofaiss";
  version = "2.17.0";
  format = "setuptools";

  disabled = pythonOlder "3.6";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "criteo";
    repo = pname;
    repo = "autofaiss";
    tag = version;
    hash = "sha256-pey3wrW7CDLMiPPKnmYrcSJqGuy6ecA2SE9m3Jtt6DU=";
  };

  build-system = [
    setuptools
  ];

  pythonRemoveDeps = [
    # The `dataclasses` packages is a python2-only backport, unnecessary in
    # python3.
@@ -41,14 +48,17 @@ buildPythonPackage rec {
    # As of v2.15.3, autofaiss asks for pyarrow<8 but we have pyarrow v9.0.0 in
    # nixpkgs at the time of writing (2022-12-15).
    "pyarrow"

    # No official numpy2 support yet
    "numpy"
  ];

  propagatedBuildInputs = [
  dependencies = [
    embedding-reader
    fsspec
    numpy
    faiss
    fire
    fsspec
    numpy
    pyarrow
  ];

@@ -61,14 +71,20 @@ buildPythonPackage rec {
    "test_index_correctness_in_distributed_mode_with_multiple_indices"
    "test_index_correctness_in_distributed_mode"
    "test_quantize_with_pyspark"

    # TypeError: Object of type float32 is not JSON serializable
    "test_quantize"
    "test_quantize_with_empty_and_non_empty_files"
    "test_quantize_with_ids"
    "test_quantize_with_multiple_inputs"
  ];

  meta = with lib; {
  meta = {
    description = "Automatically create Faiss knn indices with the most optimal similarity search parameters";
    mainProgram = "autofaiss";
    homepage = "https://github.com/criteo/autofaiss";
    changelog = "https://github.com/criteo/autofaiss/blob/${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ samuela ];
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ samuela ];
  };
}
+0 −4
Original line number Diff line number Diff line
@@ -17365,10 +17365,6 @@ with pkgs;
    jre = openjdk17;
  };
  faiss = callPackage ../development/libraries/science/math/faiss {
    pythonPackages = python3Packages;
  };
  faissWithCuda = faiss.override {
    cudaSupport = true;
  };
+1 −1
Original line number Diff line number Diff line
@@ -4450,7 +4450,7 @@ self: super: with self; {
  faiss = callPackage ../development/python-modules/faiss {
    faiss-build = pkgs.faiss.override {
      pythonSupport = true;
      pythonPackages = self;
      python3Packages = self;
    };
  };