2020-02-18 17:47:08 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, isPy27
|
|
|
|
, numpy
|
|
|
|
, scikitlearn
|
2020-08-20 20:32:06 +01:00
|
|
|
, pytestCheckHook
|
2020-02-18 17:47:08 +00:00
|
|
|
, pytorch
|
|
|
|
, torchvision
|
|
|
|
, tqdm
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytorch-metric-learning";
|
2020-12-12 22:24:49 +00:00
|
|
|
version = "0.9.95";
|
2020-02-18 17:47:08 +00:00
|
|
|
|
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KevinMusgrave";
|
|
|
|
repo = pname;
|
2020-08-20 20:32:06 +01:00
|
|
|
rev = "v${version}";
|
2020-12-12 22:24:49 +00:00
|
|
|
sha256 = "1msvs1j3n47762ahm21bnkk2qqabxw8diiyi7s420x4zg24mr23g";
|
2020-02-18 17:47:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pytorch
|
|
|
|
scikitlearn
|
|
|
|
torchvision
|
|
|
|
tqdm
|
|
|
|
];
|
|
|
|
|
2020-08-20 20:32:06 +01:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMP
|
|
|
|
export TEST_DEVICE=cpu
|
|
|
|
export TEST_DTYPES=float32,float64 # half-precision tests fail on CPU
|
|
|
|
'';
|
|
|
|
# package only requires `unittest`, but use `pytest` to exclude tests
|
|
|
|
checkInputs = [ pytestCheckHook ];
|
|
|
|
disabledTests = [
|
|
|
|
# requires FAISS (not in Nixpkgs)
|
|
|
|
"test_accuracy_calculator_and_faiss"
|
|
|
|
# require network access:
|
|
|
|
"test_get_nearest_neighbors"
|
|
|
|
"test_tuplestoweights_sampler"
|
|
|
|
"test_untrained_indexer"
|
|
|
|
];
|
|
|
|
|
2020-02-18 17:47:08 +00:00
|
|
|
meta = {
|
|
|
|
description = "Metric learning library for PyTorch";
|
|
|
|
homepage = "https://github.com/KevinMusgrave/pytorch-metric-learning";
|
|
|
|
changelog = "https://github.com/KevinMusgrave/pytorch-metric-learning/releases/tag/v${version}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|