1{
2 lib,
3 callPackage,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7 setuptools,
8 cython,
9 spacy,
10 numpy,
11 transformers,
12 torch,
13 srsly,
14 spacy-alignments,
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "spacy-transformers";
20 version = "1.3.9";
21 pyproject = true;
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "explosion";
27 repo = "spacy-transformers";
28 tag = "release-v${version}";
29 hash = "sha256-06M/e8/+hMVQdZfqyI3qGaZY7iznMwMtblEkFR6Sro0=";
30 };
31
32 build-system = [
33 setuptools
34 cython
35 ];
36
37 dependencies = [
38 spacy
39 numpy
40 transformers
41 torch
42 srsly
43 spacy-alignments
44 ];
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 pythonRelaxDeps = [ "transformers" ];
49
50 # Test fails due to missing arguments for trfs2arrays().
51 doCheck = false;
52
53 pythonImportsCheck = [ "spacy_transformers" ];
54
55 passthru.tests.annotation = callPackage ./annotation-test { };
56
57 meta = {
58 description = "spaCy pipelines for pretrained BERT, XLNet and GPT-2";
59 homepage = "https://github.com/explosion/spacy-transformers";
60 changelog = "https://github.com/explosion/spacy-transformers/releases/tag/${src.tag}";
61 license = lib.licenses.mit;
62 maintainers = with lib.maintainers; [ nickcao ];
63 };
64}