2019-12-06 18:40:29 +00:00
|
|
|
{ buildPythonPackage
|
2021-01-25 09:26:54 +01:00
|
|
|
, lib
|
2019-12-06 18:40:29 +00:00
|
|
|
, fetchFromGitHub
|
2021-01-16 11:01:21 +01:00
|
|
|
, pythonOlder
|
2020-12-02 07:54:50 +01:00
|
|
|
, cookiecutter
|
2020-07-03 18:13:29 +02:00
|
|
|
, filelock
|
2021-11-02 19:07:47 +01:00
|
|
|
, huggingface-hub
|
2021-01-16 11:01:21 +01:00
|
|
|
, importlib-metadata
|
2019-12-06 18:40:29 +00:00
|
|
|
, regex
|
2020-07-03 18:13:29 +02:00
|
|
|
, requests
|
2019-12-06 18:40:29 +00:00
|
|
|
, numpy
|
2021-04-11 10:00:26 +02:00
|
|
|
, packaging
|
2020-10-23 08:32:06 +02:00
|
|
|
, protobuf
|
2021-11-02 19:07:47 +01:00
|
|
|
, pyyaml
|
2020-07-03 18:13:29 +02:00
|
|
|
, sacremoses
|
|
|
|
, tokenizers
|
|
|
|
, tqdm
|
2019-12-06 18:40:29 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "transformers";
|
2022-02-10 16:19:12 +00:00
|
|
|
version = "4.16.2";
|
2019-12-06 18:40:29 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "huggingface";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-02-10 16:19:12 +00:00
|
|
|
sha256 = "sha256-XF29JKIaOqZ/PdU+zu+wX7TAl1TKz+HcOutHDABc/PY=";
|
2019-12-06 18:40:29 +00:00
|
|
|
};
|
|
|
|
|
2021-04-11 10:00:26 +02:00
|
|
|
nativeBuildInputs = [ packaging ];
|
|
|
|
|
2020-07-03 18:13:29 +02:00
|
|
|
propagatedBuildInputs = [
|
2020-12-02 07:54:50 +01:00
|
|
|
cookiecutter
|
2020-07-03 18:13:29 +02:00
|
|
|
filelock
|
2021-11-02 19:07:47 +01:00
|
|
|
huggingface-hub
|
2020-07-03 18:13:29 +02:00
|
|
|
numpy
|
2020-10-23 08:32:06 +02:00
|
|
|
protobuf
|
2021-11-02 19:07:47 +01:00
|
|
|
pyyaml
|
2020-07-03 18:13:29 +02:00
|
|
|
regex
|
|
|
|
requests
|
|
|
|
sacremoses
|
|
|
|
tokenizers
|
|
|
|
tqdm
|
2021-01-24 01:29:22 +01:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
|
2020-07-03 18:13:29 +02:00
|
|
|
|
2021-01-16 11:01:21 +01:00
|
|
|
# Many tests require internet access.
|
|
|
|
doCheck = false;
|
2019-12-06 18:40:29 +00:00
|
|
|
|
2020-11-10 18:22:51 +01:00
|
|
|
postPatch = ''
|
2021-02-09 20:35:06 +01:00
|
|
|
sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py
|
2020-11-10 18:22:51 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-16 11:01:21 +01:00
|
|
|
pythonImportsCheck = [ "transformers" ];
|
2020-07-03 18:13:29 +02:00
|
|
|
|
2021-01-11 08:54:33 +01: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 15:49:05 +02: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 09:04:14 +02:00
|
|
|
platforms = platforms.unix;
|
2021-09-12 14:42:12 +00:00
|
|
|
maintainers = with maintainers; [ pashashocky ];
|
2019-12-06 18:40:29 +00:00
|
|
|
};
|
|
|
|
}
|