1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 huggingface-hub,
6 nltk,
7 numpy,
8 pytestCheckHook,
9 pythonOlder,
10 scikit-learn,
11 scipy,
12 sentencepiece,
13 setuptools,
14 tokenizers,
15 torch,
16 torchvision,
17 tqdm,
18 transformers,
19}:
20
21buildPythonPackage rec {
22 pname = "sentence-transformers";
23 version = "2.7.0";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 src = fetchFromGitHub {
29 owner = "UKPLab";
30 repo = "sentence-transformers";
31 rev = "refs/tags/v${version}";
32 hash = "sha256-xER+WHprW83KWJ0bom+lTn0HNU7PgGROnp/QLG1uUcw=";
33 };
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 huggingface-hub
39 nltk
40 numpy
41 scikit-learn
42 scipy
43 sentencepiece
44 tokenizers
45 torch
46 torchvision
47 tqdm
48 transformers
49 ];
50
51 nativeCheckInputs = [ pytestCheckHook ];
52
53 pythonImportsCheck = [ "sentence_transformers" ];
54
55 disabledTests = [
56 # Tests require network access
57 "test_simple_encode"
58 "test_paraphrase_mining"
59 "test_cmnrl_same_grad"
60 "test_LabelAccuracyEvaluator"
61 "test_ParaphraseMiningEvaluator"
62 ];
63
64 disabledTestPaths = [
65 # Tests require network access
66 "tests/test_pretrained_stsb.py"
67 "tests/test_sentence_transformer.py"
68 "tests/test_compute_embeddings.py"
69 "tests/test_multi_process.py"
70 "tests/test_cross_encoder.py"
71 "tests/test_train_stsb.py"
72 ];
73
74 meta = with lib; {
75 description = "Multilingual Sentence & Image Embeddings with BERT";
76 homepage = "https://github.com/UKPLab/sentence-transformers";
77 changelog = "https://github.com/UKPLab/sentence-transformers/releases/tag/${version}";
78 license = licenses.asl20;
79 maintainers = with maintainers; [ dit7ya ];
80 };
81}