18 # optional-dependencies
23 cudaSupport ? config.cudaSupport,
28 buildPythonPackage rec {
29 pname = "pytorch-metric-learning";
35 src = fetchFromGitHub {
36 owner = "KevinMusgrave";
39 hash = "sha256-WO/gv8rKkxY3pR627WrEPVyvZnvUZIKMzOierIW8bJA=";
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);
81 "test_tuplestoweights_sampler"
82 "test_metric_loss_only"
84 "test_get_nearest_neighbors"
86 "test_untrained_indexer"
88 ++ lib.optionals stdenv.hostPlatform.isDarwin [
89 # AttributeError: module 'torch.distributed' has no attribute 'init_process_group'
92 ++ lib.optionals cudaSupport [
93 # crashes with SIGBART
94 "test_accuracy_calculator_and_faiss_with_torch_and_numpy"
95 "test_accuracy_calculator_large_k"
97 "test_global_embedding_space_tester"
98 "test_global_two_stream_embedding_space_tester"
101 "test_many_tied_distances"
102 "test_query_within_reference"
103 "test_tied_distances"
104 "test_with_same_parent_label_tester"
108 description = "Metric learning library for PyTorch";
109 homepage = "https://github.com/KevinMusgrave/pytorch-metric-learning";
110 changelog = "https://github.com/KevinMusgrave/pytorch-metric-learning/releases/tag/v${version}";
111 license = lib.licenses.mit;
112 maintainers = with lib.maintainers; [ bcdarwin ];