blob: e9728b3d676c593780c786780d9ad0b133358734 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
{ lib
, buildPythonPackage
, fetchFromGitHub
, isPy27
, numpy
, scikit-learn
, pytestCheckHook
, pytorch
, torchvision
, tqdm
}:
buildPythonPackage rec {
pname = "pytorch-metric-learning";
version = "1.1.0";
disabled = isPy27;
src = fetchFromGitHub {
owner = "KevinMusgrave";
repo = pname;
rev = "v${version}";
sha256 = "0qvlxgdml22fzrs47yzqpfzak8lfdrzayvapawfz93cq8903h7qp";
};
propagatedBuildInputs = [
numpy
pytorch
scikit-learn
torchvision
tqdm
];
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"
"test_global_embedding_space_tester"
"test_with_same_parent_label_tester"
# require network access:
"test_get_nearest_neighbors"
"test_tuplestoweights_sampler"
"test_untrained_indexer"
"test_metric_loss_only"
"test_pca"
# flaky
"test_distributed_classifier_loss_and_miner"
];
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 ];
};
}
|