2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, callPackage
|
|
|
|
, fetchPypi
|
|
|
|
, buildPythonPackage
|
2022-04-27 09:35:20 +00:00
|
|
|
, dataclasses
|
2022-09-09 14:08:57 +00:00
|
|
|
, torch
|
2021-10-06 13:57:05 +00:00
|
|
|
, pythonOlder
|
2021-05-20 23:08:51 +00:00
|
|
|
, spacy
|
|
|
|
, spacy-alignments
|
|
|
|
, srsly
|
|
|
|
, transformers
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "spacy-transformers";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "1.1.8";
|
2022-04-27 09:35:20 +00:00
|
|
|
format = "setuptools";
|
2021-10-06 13:57:05 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-09-30 11:47:45 +00:00
|
|
|
hash = "sha256-e7YuBEq2yggW5G2pJ0Rjw9z3c1jqgRKCifYSfnzblVs=";
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
torch
|
2021-05-20 23:08:51 +00:00
|
|
|
spacy
|
|
|
|
spacy-alignments
|
|
|
|
srsly
|
|
|
|
transformers
|
2022-04-27 09:35:20 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
dataclasses
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
2022-11-02 22:02:43 +00:00
|
|
|
--replace "transformers>=3.4.0,<4.22.0" "transformers>=3.4.0 # ,<4.22.0"
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Test fails due to missing arguments for trfs2arrays().
|
|
|
|
doCheck = false;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"spacy_transformers"
|
|
|
|
];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
passthru.tests.annotation = callPackage ./annotation-test { };
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "spaCy pipelines for pretrained BERT, XLNet and GPT-2";
|
|
|
|
homepage = "https://github.com/explosion/spacy-transformers";
|
|
|
|
license = licenses.mit;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
}
|