2022-12-16 08:07:50 +01:00
|
|
|
{ buildPythonPackage
|
|
|
|
, embedding-reader
|
|
|
|
, faiss
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fire
|
|
|
|
, fsspec
|
|
|
|
, lib
|
|
|
|
, numpy
|
|
|
|
, pyarrow
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonRelaxDepsHook
|
2022-12-25 15:15:29 +01:00
|
|
|
, pythonOlder
|
2022-12-16 08:07:50 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "autofaiss";
|
2022-12-25 13:05:34 +01:00
|
|
|
version = "2.15.4";
|
2022-12-25 15:15:29 +01:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
2022-12-16 08:07:50 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "criteo";
|
|
|
|
repo = pname;
|
|
|
|
rev = "refs/tags/${version}";
|
2022-12-25 13:05:34 +01:00
|
|
|
hash = "sha256-OnDHwJxJcXx3DGxrkk2D2Ljs4CqPoYx7avdo9C8sDrU=";
|
2022-12-16 08:07:50 +01:00
|
|
|
};
|
|
|
|
|
2022-12-25 15:15:29 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
2022-12-16 08:07:50 +01:00
|
|
|
|
|
|
|
pythonRemoveDeps = [
|
|
|
|
# The `dataclasses` packages is a python2-only backport, unnecessary in
|
|
|
|
# python3.
|
|
|
|
"dataclasses"
|
|
|
|
# We call it faiss, not faiss-cpu.
|
|
|
|
"faiss-cpu"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonRelaxDeps = [
|
2022-12-26 05:33:13 +01:00
|
|
|
# As of v2.15.4, autofaiss asks for fire<0.5 but we have fire v0.5.0 in
|
|
|
|
# nixpkgs at the time of writing (2022-12-25).
|
|
|
|
"fire"
|
2022-12-16 08:07:50 +01:00
|
|
|
# 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"
|
|
|
|
];
|
|
|
|
|
2022-12-25 15:15:29 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
embedding-reader
|
|
|
|
fsspec
|
|
|
|
numpy
|
|
|
|
faiss
|
|
|
|
fire
|
|
|
|
pyarrow
|
|
|
|
];
|
2022-12-16 08:07:50 +01:00
|
|
|
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = [
|
2022-12-25 15:15:29 +01:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
2022-12-16 08:07:50 +01:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Attempts to spin up a Spark cluster and talk to it which doesn't work in
|
|
|
|
# the Nix build environment.
|
|
|
|
"test_build_partitioned_indexes"
|
|
|
|
"test_index_correctness_in_distributed_mode_with_multiple_indices"
|
|
|
|
"test_index_correctness_in_distributed_mode"
|
|
|
|
"test_quantize_with_pyspark"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Automatically create Faiss knn indices with the most optimal similarity search parameters";
|
|
|
|
homepage = "https://github.com/criteo/autofaiss";
|
2022-12-25 15:15:29 +01:00
|
|
|
changelog = "https://github.com/criteo/autofaiss/blob/${version}/CHANGELOG.md";
|
2022-12-16 08:07:50 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ samuela ];
|
|
|
|
};
|
|
|
|
}
|