18 # optional-dependencies
23 cudaSupport ? config.cudaSupport,
28 buildPythonPackage rec {
29 pname = "pytorch-metric-learning";
35 src = fetchFromGitHub {
36 owner = "KevinMusgrave";
38 rev = "refs/tags/v${version}";
39 hash = "sha256-mxAl4GMyAWtvocc68Ac3z1+W13k9OOK7aQFfB7X0f9c=";
53 optional-dependencies = {
68 export TEST_DEVICE=cpu
69 export TEST_DTYPES=float32,float64 # half-precision tests fail on CPU
72 # package only requires `unittest`, but use `pytest` to exclude tests
76 ] ++ lib.flatten (lib.attrValues optional-dependencies);
80 "test_tuplestoweights_sampler"
81 "test_metric_loss_only"
83 "test_get_nearest_neighbors"
85 "test_untrained_indexer"
86 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
87 # AttributeError: module 'torch.distributed' has no attribute 'init_process_group'
89 ] ++ lib.optionals cudaSupport [
90 # crashes with SIGBART
91 "test_accuracy_calculator_and_faiss_with_torch_and_numpy"
92 "test_accuracy_calculator_large_k"
94 "test_global_embedding_space_tester"
95 "test_global_two_stream_embedding_space_tester"
98 "test_many_tied_distances"
99 "test_query_within_reference"
100 "test_tied_distances"
101 "test_with_same_parent_label_tester"
105 description = "Metric learning library for PyTorch";
106 homepage = "https://github.com/KevinMusgrave/pytorch-metric-learning";
107 changelog = "https://github.com/KevinMusgrave/pytorch-metric-learning/releases/tag/v${version}";
108 license = lib.licenses.mit;
109 maintainers = with lib.maintainers; [ bcdarwin ];