2020-05-29 06:06:01 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, isPy27
|
|
|
|
, numpy
|
2021-05-20 23:08:51 +00:00
|
|
|
, scikit-learn
|
2020-11-15 13:44:38 +00:00
|
|
|
, pytestCheckHook
|
2020-05-29 06:06:01 +00:00
|
|
|
, pytorch
|
|
|
|
, torchvision
|
|
|
|
, tqdm
|
2022-08-12 12:06:08 +00:00
|
|
|
, faiss
|
2020-05-29 06:06:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytorch-metric-learning";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "1.5.1";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KevinMusgrave";
|
|
|
|
repo = pname;
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-d7Ngd4SzGTJXtpgs2Jqb+y1aeMt9YUqIOft5ByDtRsc=";
|
2020-05-29 06:06:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pytorch
|
2021-05-20 23:08:51 +00:00
|
|
|
scikit-learn
|
2020-05-29 06:06:01 +00:00
|
|
|
torchvision
|
|
|
|
tqdm
|
|
|
|
];
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMP
|
|
|
|
export TEST_DEVICE=cpu
|
|
|
|
export TEST_DTYPES=float32,float64 # half-precision tests fail on CPU
|
|
|
|
'';
|
2022-08-12 12:06:08 +00:00
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
# package only requires `unittest`, but use `pytest` to exclude tests
|
2022-08-12 12:06:08 +00:00
|
|
|
checkInputs = [
|
|
|
|
faiss
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2020-11-15 13:44:38 +00:00
|
|
|
disabledTests = [
|
2022-08-12 12:06:08 +00:00
|
|
|
# TypeError: setup() missing 1 required positional argument: 'world_size'
|
|
|
|
"TestDistributedLossWrapper"
|
2020-11-15 13:44:38 +00:00
|
|
|
# require network access:
|
2022-08-12 12:06:08 +00:00
|
|
|
"TestInference"
|
2020-11-15 13:44:38 +00:00
|
|
|
"test_get_nearest_neighbors"
|
|
|
|
"test_tuplestoweights_sampler"
|
|
|
|
"test_untrained_indexer"
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_metric_loss_only"
|
|
|
|
"test_pca"
|
|
|
|
# flaky
|
|
|
|
"test_distributed_classifier_loss_and_miner"
|
2020-11-15 13:44:38 +00:00
|
|
|
];
|
|
|
|
|
2020-05-29 06:06:01 +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 ];
|
|
|
|
};
|
|
|
|
}
|