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
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytorch-metric-learning";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "0.9.99";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "KevinMusgrave";
|
|
|
|
repo = pname;
|
2020-11-15 13:44:38 +00:00
|
|
|
rev = "v${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "1ahs2b7q3hxi6yv4g2fjy7mvl899h56dvlpc2r9301440qsgkdzr";
|
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
|
|
|
|
'';
|
|
|
|
# package only requires `unittest`, but use `pytest` to exclude tests
|
|
|
|
checkInputs = [ pytestCheckHook ];
|
|
|
|
disabledTests = [
|
|
|
|
# requires FAISS (not in Nixpkgs)
|
|
|
|
"test_accuracy_calculator_and_faiss"
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_global_embedding_space_tester"
|
|
|
|
"test_with_same_parent_label_tester"
|
2020-11-15 13:44:38 +00:00
|
|
|
# require network access:
|
|
|
|
"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 ];
|
|
|
|
};
|
|
|
|
}
|