2020-04-24 23:36:52 +00:00
|
|
|
{ buildPythonPackage
|
2021-02-05 17:12:51 +00:00
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2021-02-05 17:12:51 +00:00
|
|
|
, pythonOlder
|
2020-12-03 08:41:04 +00:00
|
|
|
, cookiecutter
|
2020-07-18 16:06:22 +00:00
|
|
|
, filelock
|
2021-12-06 16:07:01 +00:00
|
|
|
, huggingface-hub
|
2021-02-05 17:12:51 +00:00
|
|
|
, importlib-metadata
|
2020-04-24 23:36:52 +00:00
|
|
|
, regex
|
2020-07-18 16:06:22 +00:00
|
|
|
, requests
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
2021-04-12 18:23:04 +00:00
|
|
|
, packaging
|
2020-11-03 02:18:15 +00:00
|
|
|
, protobuf
|
2021-12-06 16:07:01 +00:00
|
|
|
, pyyaml
|
2020-07-18 16:06:22 +00:00
|
|
|
, sacremoses
|
|
|
|
, tokenizers
|
|
|
|
, tqdm
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "transformers";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "4.12.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "huggingface";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-SndnMiXWiDW+E1G+WaUTVv3lySavJWF0nFDZLOxzObc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-12 18:23:04 +00:00
|
|
|
nativeBuildInputs = [ packaging ];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
propagatedBuildInputs = [
|
2020-12-03 08:41:04 +00:00
|
|
|
cookiecutter
|
2020-07-18 16:06:22 +00:00
|
|
|
filelock
|
2021-12-06 16:07:01 +00:00
|
|
|
huggingface-hub
|
2020-07-18 16:06:22 +00:00
|
|
|
numpy
|
2020-11-03 02:18:15 +00:00
|
|
|
protobuf
|
2021-12-06 16:07:01 +00:00
|
|
|
pyyaml
|
2020-07-18 16:06:22 +00:00
|
|
|
regex
|
|
|
|
requests
|
|
|
|
sacremoses
|
|
|
|
tokenizers
|
|
|
|
tqdm
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# Many tests require internet access.
|
|
|
|
doCheck = false;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
postPatch = ''
|
2021-02-13 14:23:35 +00:00
|
|
|
sed -ri 's/tokenizers[=>]=[^"]+/tokenizers/g' setup.py src/transformers/dependency_versions_table.py
|
2020-11-12 09:05:59 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
pythonImportsCheck = [ "transformers" ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/huggingface/transformers";
|
|
|
|
description = "State-of-the-art Natural Language Processing for TensorFlow 2.0 and PyTorch";
|
2020-09-25 04:45:31 +00:00
|
|
|
changelog = "https://github.com/huggingface/transformers/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2020-08-20 17:08:02 +00:00
|
|
|
platforms = platforms.unix;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ pashashocky ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|