2019-12-06 18:40:29 +00:00
|
|
|
{ buildPythonPackage
|
2021-01-25 08:26:54 +00:00
|
|
|
, lib
|
2019-12-06 18:40:29 +00:00
|
|
|
, fetchFromGitHub
|
2021-01-16 10:01:21 +00:00
|
|
|
, pythonOlder
|
2020-12-02 06:54:50 +00:00
|
|
|
, cookiecutter
|
2020-07-03 17:13:29 +01:00
|
|
|
, filelock
|
2021-01-16 10:01:21 +00:00
|
|
|
, importlib-metadata
|
2019-12-06 18:40:29 +00:00
|
|
|
, regex
|
2020-07-03 17:13:29 +01:00
|
|
|
, requests
|
2019-12-06 18:40:29 +00:00
|
|
|
, numpy
|
2020-10-23 07:32:06 +01:00
|
|
|
, protobuf
|
2020-07-03 17:13:29 +01:00
|
|
|
, sacremoses
|
|
|
|
, tokenizers
|
|
|
|
, tqdm
|
2019-12-06 18:40:29 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "transformers";
|
2021-03-19 19:30:56 +00:00
|
|
|
version = "4.4.2";
|
2019-12-06 18:40:29 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "huggingface";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-03-19 19:30:56 +00:00
|
|
|
hash = "sha256-kl1Z2FBo+yqVXUqLaUtet6IycmdcAtfydNTI4MNNrkc=";
|
2019-12-06 18:40:29 +00:00
|
|
|
};
|
|
|
|
|
2020-07-03 17:13:29 +01:00
|
|
|
propagatedBuildInputs = [
|
2020-12-02 06:54:50 +00:00
|
|
|
cookiecutter
|
2020-07-03 17:13:29 +01:00
|
|
|
filelock
|
|
|
|
numpy
|
2020-10-23 07:32:06 +01:00
|
|
|
protobuf
|
2020-07-03 17:13:29 +01:00
|
|
|
regex
|
|
|
|
requests
|
|
|
|
sacremoses
|
|
|
|
tokenizers
|
|
|
|
tqdm
|
2021-01-24 00:29:22 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
|
2020-07-03 17:13:29 +01:00
|
|
|
|
2021-01-16 10:01:21 +00:00
|
|
|
# Many tests require internet access.
|
|
|
|
doCheck = false;
|
2019-12-06 18:40:29 +00:00
|
|
|
|
2020-11-10 17:22:51 +00:00
|
|
|
postPatch = ''
|
2021-02-09 19:35:06 +00:00
|
|
|
sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py
|
2020-11-10 17:22:51 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-16 10:01:21 +00:00
|
|
|
pythonImportsCheck = [ "transformers" ];
|
2020-07-03 17:13:29 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-12-06 18:40:29 +00:00
|
|
|
homepage = "https://github.com/huggingface/transformers";
|
|
|
|
description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";
|
2020-09-01 14:49:05 +01:00
|
|
|
changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
|
2019-12-06 18:40:29 +00:00
|
|
|
license = licenses.asl20;
|
2020-08-05 08:04:14 +01:00
|
|
|
platforms = platforms.unix;
|
2020-07-03 17:13:09 +01:00
|
|
|
maintainers = with maintainers; [ danieldk pashashocky ];
|
2019-12-06 18:40:29 +00:00
|
|
|
};
|
|
|
|
}
|