about summary refs log tree commit diff
path: root/pkgs/development/python-modules/sentence-transformers/default.nix
blob: d0174236cebd9c4e6b837d3cd0104678ac5daa85 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ lib
, buildPythonPackage
, fetchFromGitHub
, huggingface-hub
, nltk
, numpy
, pytestCheckHook
, pythonOlder
, scikit-learn
, scipy
, sentencepiece
, setuptools
, tokenizers
, torch
, torchvision
, tqdm
, transformers
}:

buildPythonPackage rec {
  pname = "sentence-transformers";
  version = "2.6.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "UKPLab";
    repo = "sentence-transformers";
    rev = "refs/tags/v${version}";
    hash = "sha256-09AAuv/yXTbBvjA4gu5ueZrQkVja0BTIGNLZ2tLSyh8=";
  };

  build-system = [
    setuptools
  ];

  dependencies = [
    huggingface-hub
    nltk
    numpy
    scikit-learn
    scipy
    sentencepiece
    tokenizers
    torch
    torchvision
    tqdm
    transformers
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "sentence_transformers"
  ];

  disabledTests = [
    # Tests require network access
    "test_simple_encode"
    "test_paraphrase_mining"
    "test_cmnrl_same_grad"
    "test_LabelAccuracyEvaluator"
    "test_ParaphraseMiningEvaluator"
  ];

  disabledTestPaths = [
    # Tests require network access
    "tests/test_pretrained_stsb.py"
    "tests/test_sentence_transformer.py"
    "tests/test_compute_embeddings.py"
    "tests/test_multi_process.py"
    "tests/test_cross_encoder.py"
    "tests/test_train_stsb.py"
  ];

  meta = with lib; {
    description = "Multilingual Sentence & Image Embeddings with BERT";
    homepage = "https://github.com/UKPLab/sentence-transformers";
    changelog = "https://github.com/UKPLab/sentence-transformers/releases/tag/${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ dit7ya ];
  };
}